Sha256: 989c7f8c2d808fb99a44801af8149d35269d53147da50345389e5cdc49edd69a

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

require_relative 'unary_input_expression'

module Zenlish
  module Inflect
    class Membership < UnaryInputExpression
      attr_reader :members

      def initialize(anArgument, theMembers)
        super(anArgument)
        @members = theMembers
      end

      def success?(headings, lexeme, actuals)
        if actuals.empty?
          hd = headings[argument.index]
          feat_def = hd.evaluate_for(lexeme)
          members.all? { |memb| feat_def.domain.include?(memb) }
        else
          val = actuals[argument.index]
          members.include?(val)
        end
      end
    end # class
  end # module
end # module

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zenlish-0.2.05 lib/zenlish/inflect/membership.rb
zenlish-0.2.04 lib/zenlish/inflect/membership.rb
zenlish-0.2.03 lib/zenlish/inflect/membership.rb
zenlish-0.2.02 lib/zenlish/inflect/membership.rb
zenlish-0.2.01 lib/zenlish/inflect/membership.rb