46 lines
782 B
Ruby
46 lines
782 B
Ruby
|
module OrbitApp
|
||
|
module Summary
|
||
|
Version = "0.2"
|
||
|
|
||
|
module ClassMethods
|
||
|
@@summaries = []
|
||
|
|
||
|
def new( name ,&block)
|
||
|
@@summaries << Item.new(name,&block)
|
||
|
# binding.pry
|
||
|
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
|