Class: Yaoc::OneToManyMapperChain
- Inherits:
-
Object
- Object
- Yaoc::OneToManyMapperChain
- Defined in:
- lib/yaoc/one_to_many_mapper_chain.rb
Instance Attribute Summary collapse
-
#converter ⇒ Object
readonly
Returns the value of attribute converter.
-
#last_result ⇒ Object
Returns the value of attribute last_result.
-
#next_result ⇒ Object
Returns the value of attribute next_result.
Class Method Summary collapse
Instance Method Summary collapse
- #dump_all(input_object, objects_to_fill = nil) ⇒ Object
-
#initialize(*converter) ⇒ OneToManyMapperChain
constructor
A new instance of OneToManyMapperChain.
- #load_all(input_object, objects_to_fill = []) ⇒ Object
Constructor Details
#initialize(*converter) ⇒ OneToManyMapperChain
Returns a new instance of OneToManyMapperChain.
9 10 11 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 9 def initialize(*converter) self.converter = converter end |
Instance Attribute Details
#converter ⇒ Object
Returns the value of attribute converter.
3 4 5 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 3 def converter @converter end |
#last_result ⇒ Object
Returns the value of attribute last_result.
3 4 5 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 3 def last_result @last_result end |
#next_result ⇒ Object
Returns the value of attribute next_result.
3 4 5 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 3 def next_result @next_result end |
Class Method Details
.registry ⇒ Object
5 6 7 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 5 def self.registry Yaoc::MapperRegistry end |
Instance Method Details
#dump_all(input_object, objects_to_fill = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 24 def dump_all(input_object, objects_to_fill = nil) objects_to_fill = Array(objects_to_fill) results = [] each_object_with_converter(objects_to_fill) do |converter, object_to_fill| results << converter.dump(input_object, object_to_fill) end self.last_result = results end |
#load_all(input_object, objects_to_fill = []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yaoc/one_to_many_mapper_chain.rb', line 13 def load_all(input_object, objects_to_fill = []) objects_to_fill = Array(objects_to_fill) results = [] each_object_with_converter(objects_to_fill) do |converter, object_to_fill| results << converter.load(input_object, object_to_fill) end self.last_result = results end |