class MR::Factory::Config::ObjectBuilder

Public Class Methods

apply_hash(object, factory_config, hash) click to toggle source
# 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) click to toggle source
# 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
new(object, factory_config) click to toggle source
# File lib/mr/factory/config.rb, line 69
def initialize(object, factory_config)
  @__mr_ob_object         = object
  @__mr_ob_factory_config = factory_config
end

Public Instance Methods

set(name, value) click to toggle source
# 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

Private Instance Methods

__mr_ob_set_attribute(object, name, value) click to toggle source
# File lib/mr/factory/config.rb, line 83
def __mr_ob_set_attribute(object, name, value)
  object.send("#{name}=", value)
end