Can anyone tell me why fred.my_class_method does not work? Fred is a
person class is it not?
here's the code slightly modified:

require 'date'

class Person
  puts self #Person as an instance of Class

  def self.my_class_method
    puts "This is my own class method"
  end

  def initialize(name, dob)
    @name = name
    @dob  = Date.parse(dob)
  end

  def age
    # ...
  end

  def marry(someone)
    # ...
  end
end

fred = Person.new("Fred", "1967-12-25")
p fred
puts fred.inspect
puts fred
Person.my_class_method
fred.my_class_method

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to