Sha256: ebe417c95fe5719f57574d3a532483c5bd61e6faba32c066c4d03b8821278aba

Contents?: true

Size: 541 Bytes

Versions: 4

Compression:

Stored size: 541 Bytes

Contents

module Adhearsion
  module MenuDSL
    class FixnumMatchCalculator < MatchCalculator

      def match(query)
        numeric_query = coerce_to_numeric query
        exact_match, potential_match = nil
        if pattern == numeric_query
          exact_match = pattern
        elsif pattern.to_s.starts_with? query.to_s
          potential_match = pattern
        end
        new_calculated_match :query => query, :exact_matches => exact_match, :potential_matches => potential_match
      end

    end # class FixnumMatchCalculator
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adhearsion-2.0.0.beta1 lib/adhearsion/menu_dsl/fixnum_match_calculator.rb
adhearsion-2.0.0.alpha3 lib/adhearsion/menu_dsl/fixnum_match_calculator.rb
adhearsion-2.0.0.alpha2 lib/adhearsion/menu_dsl/fixnum_match_calculator.rb
adhearsion-2.0.0.alpha1 lib/adhearsion/menu_dsl/fixnum_match_calculator.rb