Module: Pipeloader::FieldSelects
- Defined in:
- lib/pipeloader/field_exact.rb
Overview
Monkey-patches ‘field` to (a) accept the `selects:` escape hatch and (b) attach the projection extension when this field’s type has opted in.
Instance Attribute Summary collapse
-
#pipeloader_selects ⇒ Object
readonly
Returns the value of attribute pipeloader_selects.
Instance Method Summary collapse
Instance Attribute Details
#pipeloader_selects ⇒ Object (readonly)
Returns the value of attribute pipeloader_selects.
25 26 27 |
# File 'lib/pipeloader/field_exact.rb', line 25 def pipeloader_selects @pipeloader_selects end |
Instance Method Details
#initialize(*args, selects: nil, owner: nil, extensions: [], **kwargs, &block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pipeloader/field_exact.rb', line 27 def initialize(*args, selects: nil, owner: nil, extensions: [], **kwargs, &block) @pipeloader_selects = selects && Array(selects).map(&:to_s) if Pipeloader.field_exact || (owner.respond_to?(:pipeloader_field_exact?) && owner.pipeloader_field_exact?) extensions = extensions + [ProjectionExtension] end super(*args, owner: owner, extensions: extensions, **kwargs, &block) end |