orbit-basic/lib/orbit_app/summary.rb

46 lines
782 B
Ruby
Raw Permalink Normal View History

2012-09-13 10:31:44 +00:00
module OrbitApp
module Summary
2013-03-22 06:19:10 +00:00
Version = "0.2"
2012-09-13 10:31:44 +00:00
module ClassMethods
@@summaries = []
def new( name ,&block)
@@summaries << Item.new(name,&block)
# binding.pry
2012-09-13 10:31:44 +00:00
end
def all
return @@summaries
end
end
extend ClassMethods
def self.included( other )
other.extend( ClassMethods )
end
# def initialize( k )
# @@summaries += 1
# binding.pry
# end
class Item
@name =""
def initialize(name = "test",&block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def get_name
return @name
end
end
end
end