Class: Graphlyte::Selector::SelectAction
- Inherits:
-
Object
- Object
- Graphlyte::Selector::SelectAction
- Defined in:
- lib/graphlyte/selector.rb
Overview
Each block defined with ‘at` receives as its only argument a `SelectAction`. This object exposes method allowing the caller to modify the query.
Instance Method Summary collapse
-
#append(&block) ⇒ Object
Construct a new selection using the block, and append it to the current field selection.
-
#initialize(field, action) ⇒ SelectAction
constructor
A new instance of SelectAction.
-
#remove ⇒ Object
Remove the current node.
Constructor Details
#initialize(field, action) ⇒ SelectAction
Returns a new instance of SelectAction.
56 57 58 59 |
# File 'lib/graphlyte/selector.rb', line 56 def initialize(field, action) @field = field @action = action end |
Instance Method Details
#append(&block) ⇒ Object
Construct a new selection using the block, and append it to the current field selection.
68 69 70 71 72 |
# File 'lib/graphlyte/selector.rb', line 68 def append(&block) selection = SelectionBuilder.build(@action.document, &block) @field.selection += selection end |
#remove ⇒ Object
Remove the current node.
62 63 64 |
# File 'lib/graphlyte/selector.rb', line 62 def remove @action.delete end |