Sha256: c89616beb56db6bb60275a3d6972ac01fc2fb7f097d53e9187e1669dfa1a4120

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

require_relative 'unary_input_expression'

module Zenlish
  module Inflect
    class EqualsLiteral < UnaryInputExpression
      attr_reader :literal

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

      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]
          if val.kind_of?(Feature::FeatureDef)
            val.domain.include?(literal)
          else
            val == literal
          end
        end
      end
    end # class
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zenlish-0.2.05 lib/zenlish/inflect/equals_literal.rb