ga-wdi-boston / ruby-object-self

Other
1 stars 141 forks source link

Code about self referring to the class #20

Open raq929 opened 7 years ago

raq929 commented 7 years ago

The current code is

class Person
  puts "In a class,  self is #{self}."
end

I think we should also include the more practical use case:

class Person
  def self.some_method
  end
end
BenGitsCode commented 7 years ago

Why didn't you add this in the 016 update?

raq929 commented 7 years ago

I wanted to discuss it with someone before adding it in, but I didn't really have time. It also opens up a potential rabbit hole. This material is pretty well covered in ruby-object-class-methods.

gaand commented 7 years ago

Why not combine those?

class Person
  def self.a_class_method
    puts "In a class method,  self is #{self}."
  end  
end

Also, what's the hole with rabbits?