Method: CSDL::Processor#on_operator

Defined in:
lib/csdl/processor.rb

#on_operator(node) ⇒ String

Process :operator nodes, ensuring the the given terminator value is a valid operator.

Examples:

node = s(:operator, :contains)
CSDL::Processor.new.process(node) # => 'contains'

Parameters:

  • node (AST::Node)

    The :operator node to be processed.

Returns:

  • (String)

    The first child, stringified.

Raises:



140
141
142
143
144
145
146
# File 'lib/csdl/processor.rb', line 140

def on_operator(node)
  operator = node.children.first.to_s
  unless ::CSDL.operator?(operator)
    fail ::CSDL::UnknownOperatorError, "Operator #{operator} is unknown"
  end
  operator
end