/ Published in: Ruby

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
