Return to Snippet

Revision: 42732
at March 9, 2011 20:21 by Shamaoke


Initial Code
class Example
  class << self
    define_method(:one) { puts 'one' }
    define_method(:two) { puts 'two' }
  end

  define_method(:three) { puts 'three' }
  define_method(:four)  { puts 'four'  }
end

Example.one #=> one
Example.two #=> two

Example.new.three #=> three
Example.new.four  #=> four

Initial URL


Initial Description


Initial Title
Defining the instance and class methods using define_method

Initial Tags
ruby

Initial Language
Ruby