Class: ROM::Components::Dataset
- Defined in:
- lib/rom/components/dataset.rb,
lib/rom/compat/components.rb
Instance Method Summary collapse
- #adapter ⇒ Object
- #blocks ⇒ Object private
- #build ⇒ Object
- #evaluate_block(ds, block) ⇒ Object private
- #relation_id ⇒ Object
Instance Method Details
#adapter ⇒ Object
31 32 33 |
# File 'lib/rom/components/dataset.rb', line 31 def adapter config.adapter end |
#blocks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/rom/components/dataset.rb', line 21 def blocks [*dataset_components.map(&:block), block].compact end |
#build ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rom/components/dataset.rb', line 10 def build if gateway? blocks.reduce(gateway.dataset(id)) { |ds, blk| evaluate_block(ds, blk) } elsif block schema ? block.(schema) : block.() else EMPTY_ARRAY end end |
#evaluate_block(ds, block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/rom/components/dataset.rb', line 26 def evaluate_block(ds, block) ds.instance_exec(schema, &block) end |
#relation_id ⇒ Object
36 37 38 |
# File 'lib/rom/components/dataset.rb', line 36 def relation_id config.relation_id end |