Class: MR::Factory::ReadModelFactory
- Inherits:
-
Object
- Object
- MR::Factory::ReadModelFactory
- Defined in:
- lib/mr/factory/read_model_factory.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#read_model_class ⇒ Object
readonly
Returns the value of attribute read_model_class.
Instance Method Summary collapse
-
#initialize(read_model_class, &block) ⇒ ReadModelFactory
constructor
A new instance of ReadModelFactory.
- #read_model(args = nil) ⇒ Object (also: #instance)
- #read_model_data(args = nil) ⇒ Object
Constructor Details
#initialize(read_model_class, &block) ⇒ ReadModelFactory
Returns a new instance of ReadModelFactory.
12 13 14 15 16 17 18 19 |
# File 'lib/mr/factory/read_model_factory.rb', line 12 def initialize(read_model_class, &block) unless read_model_class < MR::ReadModelStruct raise ArgumentError, "takes a read model or read model struct" end @read_model_class = read_model_class @config = Config.new(read_model_class) self.instance_eval(&block) if block end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/mr/factory/read_model_factory.rb', line 10 def config @config end |
#read_model_class ⇒ Object (readonly)
Returns the value of attribute read_model_class.
10 11 12 |
# File 'lib/mr/factory/read_model_factory.rb', line 10 def read_model_class @read_model_class end |
Instance Method Details
#read_model(args = nil) ⇒ Object Also known as: instance
27 28 29 |
# File 'lib/mr/factory/read_model_factory.rb', line 27 def read_model(args = nil) @read_model_class.new(self.read_model_data(args)) end |