Class: ParsingNesting::Tree::MandatoryClause

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#to_query

Constructor Details

#initialize(v) ⇒ MandatoryClause

Returns a new instance of MandatoryClause.



365
366
367
# File 'lib/parsing_nesting/tree.rb', line 365

def initialize(v)
  self.operand = v
end

Instance Attribute Details

#operandObject

Returns the value of attribute operand.



364
365
366
# File 'lib/parsing_nesting/tree.rb', line 364

def operand
  @operand
end

Instance Method Details

#can_embed?Boolean

Returns:

  • (Boolean)


369
370
371
372
373
# File 'lib/parsing_nesting/tree.rb', line 369

def can_embed?
  #right now '+' clauses only apply to terms/phrases
  #which we can embed with a + in front. 
  true
end

#negateObject

negating mandatory to excluded is decent semantics, although it’s not strictly ‘true’, it’s a choice.



380
381
382
# File 'lib/parsing_nesting/tree.rb', line 380

def negate
  ExcludedClause.new( operand )
end

#to_embedObject



374
375
376
# File 'lib/parsing_nesting/tree.rb', line 374

def to_embed
  '+' + operand.to_embed
end