Class: MR::Factory::Config::ObjectBuilder
- Inherits:
-
Object
- Object
- MR::Factory::Config::ObjectBuilder
show all
- Defined in:
- lib/mr/factory/config.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(object, factory_config) ⇒ ObjectBuilder
Returns a new instance of ObjectBuilder.
69
70
71
72
|
# File 'lib/mr/factory/config.rb', line 69
def initialize(object, factory_config)
@__mr_ob_object = object
@__mr_ob_factory_config = factory_config
end
|
Class Method Details
.apply_hash(object, factory_config, hash) ⇒ Object
57
58
59
60
61
|
# File 'lib/mr/factory/config.rb', line 57
def self.apply_hash(object, factory_config, hash)
self.new(object, factory_config).tap do |builder|
hash.each{ |k, v| builder.set(k, v) }
end
end
|
.apply_proc(object, factory_config, &proc) ⇒ Object
63
64
65
66
67
|
# File 'lib/mr/factory/config.rb', line 63
def self.apply_proc(object, factory_config, &proc)
self.new(object, factory_config).tap do |builder|
builder.instance_eval(&proc)
end
end
|
Instance Method Details
#set(name, value) ⇒ Object
74
75
76
77
78
79
|
# File 'lib/mr/factory/config.rb', line 74
def set(name, value)
__mr_ob_set_attribute(@__mr_ob_object, name, value)
rescue ArgumentError => exception
exception.set_backtrace(caller)
raise exception
end
|