Class: ConceptQL::Tree

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Tree

Returns a new instance of Tree.



7
8
9
10
11
12
# File 'lib/conceptql/tree.rb', line 7

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

Instance Attribute Details

#behaviorObject (readonly)

Returns the value of attribute behavior.



6
7
8
# File 'lib/conceptql/tree.rb', line 6

def behavior
  @behavior
end

#definedObject (readonly)

Returns the value of attribute defined.



6
7
8
# File 'lib/conceptql/tree.rb', line 6

def defined
  @defined
end

#nodifierObject (readonly)

Returns the value of attribute nodifier.



6
7
8
# File 'lib/conceptql/tree.rb', line 6

def nodifier
  @nodifier
end

#optsObject (readonly)

Returns the value of attribute opts.



6
7
8
# File 'lib/conceptql/tree.rb', line 6

def opts
  @opts
end

Instance Method Details

#root(*queries) ⇒ Object



14
15
16
# File 'lib/conceptql/tree.rb', line 14

def root(*queries)
  @root ||= traverse(queries.flatten.map(&:statement).flatten.map(&:deep_symbolize_keys))
end