Class: Mycommands::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/mycommands/factory.rb

Constant Summary collapse

@@objects =
[]

Class Method Summary collapse

Class Method Details

.get(_class) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/mycommands/factory.rb', line 4

def self.get _class
  for object in @@objects
    return object if object.class == eval(_class.to_s)
  end
  object = eval(_class.to_s).new
  @@objects.push object
  object
end