Class: Graphlyte::Selector::SelectAction

Inherits:
Object
  • Object
show all
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

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

#removeObject

Remove the current node.



62
63
64
# File 'lib/graphlyte/selector.rb', line 62

def remove
  @action.delete
end