Class: Eps::Evaluators::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/eps/evaluators/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(predicate: nil, score: nil, children: nil, leaf_index: nil) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
11
# File 'lib/eps/evaluators/node.rb', line 6

def initialize(predicate: nil, score: nil, children: nil, leaf_index: nil)
  @predicate = predicate
  @children = children || []
  @score = score
  @leaf_index = leaf_index
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



4
5
6
# File 'lib/eps/evaluators/node.rb', line 4

def children
  @children
end

#leaf_indexObject

Returns the value of attribute leaf_index.



4
5
6
# File 'lib/eps/evaluators/node.rb', line 4

def leaf_index
  @leaf_index
end

#predicateObject

Returns the value of attribute predicate.



4
5
6
# File 'lib/eps/evaluators/node.rb', line 4

def predicate
  @predicate
end

#scoreObject

Returns the value of attribute score.



4
5
6
# File 'lib/eps/evaluators/node.rb', line 4

def score
  @score
end

Instance Method Details

#fieldObject



13
14
15
# File 'lib/eps/evaluators/node.rb', line 13

def field
  @predicate[:field]
end

#operatorObject



17
18
19
# File 'lib/eps/evaluators/node.rb', line 17

def operator
  @predicate[:operator]
end

#valueObject



21
22
23
# File 'lib/eps/evaluators/node.rb', line 21

def value
  @predicate[:value]
end