Class: Fabricas::CleanRoom

Inherits:
BasicObject
Defined in:
lib/fabricas.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ CleanRoom

Returns a new instance of CleanRoom.



49
50
51
52
# File 'lib/fabricas.rb', line 49

def initialize(name)
  @attributes = {}
  @class_name = name.is_a?(::String) ? name.downcase.to_sym : name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



54
55
56
# File 'lib/fabricas.rb', line 54

def method_missing(method_name, *args, &block)
  attributes[method_name] = args.first || block
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



47
48
49
# File 'lib/fabricas.rb', line 47

def attributes
  @attributes
end

#class_nameObject

Returns the value of attribute class_name.



47
48
49
# File 'lib/fabricas.rb', line 47

def class_name
  @class_name
end

Instance Method Details

#factory(klass, args = {}, &block) ⇒ Object



58
59
60
# File 'lib/fabricas.rb', line 58

def factory(klass, args={}, &block)
  ::Fabricas.factory(klass, args.merge(parent: self), &block)
end