Class: ScopedSearch::QueryLanguage::AST::LeafNode

Inherits:
Node
  • Object
show all
Defined in:
lib/scoped_search/query_language/ast.rb

Overview

AST lead node. This node represents leafs in the AST and can represent either a search phrase or a search field name.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#compatible_with, #inspect, #simplify

Constructor Details

#initialize(value) ⇒ LeafNode

:nodoc



44
45
46
# File 'lib/scoped_search/query_language/ast.rb', line 44

def initialize(value) # :nodoc
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value



42
43
44
# File 'lib/scoped_search/query_language/ast.rb', line 42

def value
  @value
end

Instance Method Details

#empty?Boolean



57
58
59
# File 'lib/scoped_search/query_language/ast.rb', line 57

def empty?
  false
end

#eql?(node) ⇒ Boolean

:nodoc



53
54
55
# File 'lib/scoped_search/query_language/ast.rb', line 53

def eql?(node) # :nodoc
  node.kind_of?(LeafNode) && node.value == value
end

#to_aObject

Return an array representation for the node



49
50
51
# File 'lib/scoped_search/query_language/ast.rb', line 49

def to_a
  value
end