Class: InterMine::PathQuery::LogicGroup
- Defined in:
- lib/intermine/query.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(left, op, right, parent = nil) ⇒ LogicGroup
constructor
A new instance of LogicGroup.
- #to_s ⇒ Object
Constructor Details
#initialize(left, op, right, parent = nil) ⇒ LogicGroup
Returns a new instance of LogicGroup.
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 |
# File 'lib/intermine/query.rb', line 1431 def initialize(left, op, right, parent=nil) if !["AND", "OR"].include?(op) raise ArgumentError, "#{op} is not a legal logical operator" end @parent = parent @left = left @op = op @right = right [left, right].each do |node| if node.is_a?(LogicGroup) node.parent = self end end end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
1428 1429 1430 |
# File 'lib/intermine/query.rb', line 1428 def left @left end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
1428 1429 1430 |
# File 'lib/intermine/query.rb', line 1428 def op @op end |
#parent ⇒ Object
Returns the value of attribute parent.
1429 1430 1431 |
# File 'lib/intermine/query.rb', line 1429 def parent @parent end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
1428 1429 1430 |
# File 'lib/intermine/query.rb', line 1428 def right @right end |
Instance Method Details
#code ⇒ Object
1455 1456 1457 |
# File 'lib/intermine/query.rb', line 1455 def code return to_s end |
#to_s ⇒ Object
1446 1447 1448 1449 1450 1451 1452 1453 |
# File 'lib/intermine/query.rb', line 1446 def to_s core = [@left.code, @op.downcase, @right.code].join(" ") if @parent && @op != @parent.op return "(#{core})" else return core end end |