Sha256: 0200fe1a0ce22c1537c5bca3175a1e331aca0997bc408d2cff47f6273162f97d

Contents?: true

Size: 599 Bytes

Versions: 6

Compression:

Stored size: 599 Bytes

Contents

require_relative 'unary_input_expression'

module Zenlish
  module Inflect
    class MatchesPattern < UnaryInputExpression
      attr_reader :pattern

      def initialize(anArgument, aPattern)
        super(anArgument)
        @pattern = aPattern
      end

      def success?(headings, lexeme, actuals)
        val = nil
        if actuals.empty?
          # require 'debug'
          hd = headings[argument.index]
          val = hd.evaluate_for(lexeme)
        else
          val = actuals[argument.index]
        end
        val =~ pattern
      end
    end # class
  end # module
end # module

Version data entries

6 entries across 6 versions & 1 rubygems

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