Module: DataBroker::Mapper::ClassMethods
- Defined in:
- lib/data_broker/mapper.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#mapping ⇒ Object
Returns the value of attribute mapping.
-
#model ⇒ Object
Returns the value of attribute model.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#record ⇒ Object
Returns the value of attribute record.
Instance Method Summary collapse
- #all(eager_load: false) ⇒ Object
- #construct_instance ⇒ Object
- #destroy(model, eager_load: false) ⇒ Object
- #find(id, eager_load: true) ⇒ Object
- #save(model, eager_load: true) ⇒ Object
- #where(eager_load: true, **conds) ⇒ Object
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
20 21 22 |
# File 'lib/data_broker/mapper.rb', line 20 def children @children end |
#mapping ⇒ Object
Returns the value of attribute mapping.
20 21 22 |
# File 'lib/data_broker/mapper.rb', line 20 def mapping @mapping end |
#model ⇒ Object
Returns the value of attribute model.
20 21 22 |
# File 'lib/data_broker/mapper.rb', line 20 def model @model end |
#parents ⇒ Object
Returns the value of attribute parents.
20 21 22 |
# File 'lib/data_broker/mapper.rb', line 20 def parents @parents end |
#record ⇒ Object
Returns the value of attribute record.
20 21 22 |
# File 'lib/data_broker/mapper.rb', line 20 def record @record end |
Instance Method Details
#all(eager_load: false) ⇒ Object
30 31 32 |
# File 'lib/data_broker/mapper.rb', line 30 def all(eager_load: false) construct_instance.all(:eager_load => eager_load) end |
#construct_instance ⇒ Object
50 51 52 53 54 55 |
# File 'lib/data_broker/mapper.rb', line 50 def construct_instance self.new( :mapping => mapping, :parents => parents, :children => children, :record => @record, :model => @model ) end |
#destroy(model, eager_load: false) ⇒ Object
46 47 48 |
# File 'lib/data_broker/mapper.rb', line 46 def destroy(model, eager_load: false) construct_instance.destroy(model, :eager_load => eager_load) end |
#find(id, eager_load: true) ⇒ Object
34 35 36 |
# File 'lib/data_broker/mapper.rb', line 34 def find(id, eager_load: true) construct_instance.find(id, :eager_load => eager_load) end |
#save(model, eager_load: true) ⇒ Object
42 43 44 |
# File 'lib/data_broker/mapper.rb', line 42 def save(model, eager_load: true) construct_instance.save(model, :eager_load => eager_load) end |
#where(eager_load: true, **conds) ⇒ Object
38 39 40 |
# File 'lib/data_broker/mapper.rb', line 38 def where(eager_load: true, **conds) construct_instance.where(:eager_load => true, **conds) end |