Sha256: b2e62d96c606d5d4f773227fc9e5753c44b96f8f16514204708d4ced3c3e95a2

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module Adhearsion
  module MenuDSL

    class StringMatchCalculator < MatchCalculator

      def match(query)
        args = { :query => query, :exact_matches => nil, :potential_matches => nil }

        if pattern == query.to_s
          args[:exact_matches] = [pattern]
        elsif pattern.starts_with? query.to_s
          args[:potential_matches] = [pattern]
        end

        new_calculated_match args
      end

    end # class StringMatchCalculator

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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