Learning Ruby - class
#!/usr/env/ruby class Dog FORMAT = 'we have %d dogs.' @@num = 0 class << self def count sprintf(FORMAT, @@num) end end def initialize(name) @name = name @@num += 1 end def say 'I am ' << @name end end puts Dog.new('pochi').say puts Dog.new('chalo').say p Dog.count