Class: ConceptQL::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/conceptql/tree.rb

Overview

Tree is used to walk through a ConceptQL statement, instantiate all operators, and then provide access to the root operator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Tree

Returns a new instance of Tree.



12
13
14
15
16
17
18
19
# File 'lib/conceptql/tree.rb', line 12

def initialize(opts = {})
  @nodifier = opts.fetch(:nodifier, Nodifier.new)
  @behavior = opts.fetch(:behavior, nil)
  @defined = {}
  @temp_tables = {}
  @opts = {}
  @scope = opts.fetch(:scope, Scope.new)
end

Instance Attribute Details

#behaviorObject (readonly)

Returns the value of attribute behavior.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def behavior
  @behavior
end

#definedObject (readonly)

Returns the value of attribute defined.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def defined
  @defined
end

#nodifierObject (readonly)

Returns the value of attribute nodifier.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def nodifier
  @nodifier
end

#optsObject (readonly)

Returns the value of attribute opts.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def opts
  @opts
end

#scopeObject (readonly)

Returns the value of attribute scope.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def scope
  @scope
end

#temp_tablesObject (readonly)

Returns the value of attribute temp_tables.



11
12
13
# File 'lib/conceptql/tree.rb', line 11

def temp_tables
  @temp_tables
end

Instance Method Details

#root(query) ⇒ Object



21
22
23
# File 'lib/conceptql/tree.rb', line 21

def root(query)
  @root ||= start_traverse(query.statement)
end