Class: Zenlish::Inflect::NotEqualsLiteral

Inherits:
UnaryInputExpression show all
Defined in:
lib/zenlish/inflect/not_equals_literal.rb

Instance Attribute Summary collapse

Attributes inherited from UnaryInputExpression

#argument

Instance Method Summary collapse

Constructor Details

#initialize(anArgument, aLiteral) ⇒ NotEqualsLiteral

Returns a new instance of NotEqualsLiteral.



8
9
10
11
# File 'lib/zenlish/inflect/not_equals_literal.rb', line 8

def initialize(anArgument, aLiteral)
  super(anArgument)
  @literal = aLiteral
end

Instance Attribute Details

#literalObject (readonly)

Returns the value of attribute literal.



6
7
8
# File 'lib/zenlish/inflect/not_equals_literal.rb', line 6

def literal
  @literal
end

Instance Method Details

#success?(headings, lexeme, actuals) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
# File 'lib/zenlish/inflect/not_equals_literal.rb', line 13

def success?(headings, lexeme, actuals)
  if actuals.empty?
    hd = headings[argument.index]
    feat_def = hd.evaluate_for(lexeme)
    !feat_def.domain.include?(literal)
  else
    val = actuals[argument.index]
    val != literal
  end
end