module MR::Factory::Config::InstanceMethods
Attributes
object_class[R]
Public Class Methods
new(object_class)
click to toggle source
# File lib/mr/factory/config.rb, line 17 def initialize(object_class) @object_class = object_class end
Public Instance Methods
apply_args(object, args)
click to toggle source
make the methods lazy-eval'd so factories can be built without paying the performance of them building out their config, this makes it less costly to require real and fake factories together in a test suite (i.e. we don't want to split our real and fake factories into separate files)
# File lib/mr/factory/config.rb, line 27 def apply_args(object, args) apply_default_args(object) apply_args_from_hash(object, args) true end
set_default_args(&block)
click to toggle source
# File lib/mr/factory/config.rb, line 33 def set_default_args(&block) @default_args_proc = block end
Private Instance Methods
apply_args_from_hash(object, args_hash)
click to toggle source
# File lib/mr/factory/config.rb, line 45 def apply_args_from_hash(object, args_hash) object_builder_class.apply_hash(object, self, args_hash) end
apply_args_from_proc(object, &args_proc)
click to toggle source
# File lib/mr/factory/config.rb, line 49 def apply_args_from_proc(object, &args_proc) object_builder_class.apply_proc(object, self, &args_proc) end
apply_default_args(object)
click to toggle source
# File lib/mr/factory/config.rb, line 41 def apply_default_args(object) apply_args_from_proc(object, &@default_args_proc) if @default_args_proc end
object_builder_class()
click to toggle source
# File lib/mr/factory/config.rb, line 39 def object_builder_class; ObjectBuilder; end