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.



356
357
358
# File 'lib/parsing_nesting/tree.rb', line 356

def initialize(v)
  self.operand = v
end

Instance Attribute Details

#operandObject

Returns the value of attribute operand.



355
356
357
# File 'lib/parsing_nesting/tree.rb', line 355

def operand
  @operand
end

Instance Method Details

#can_embed?Boolean

Returns:

  • (Boolean)


360
361
362
363
364
# File 'lib/parsing_nesting/tree.rb', line 360

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.



372
373
374
# File 'lib/parsing_nesting/tree.rb', line 372

def negate
  ExcludedClause.new(operand)
end

#to_embedObject



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

def to_embed
  '+' + operand.to_embed
end