Sha256: 00cf1e2b9c604821145745920b627bb395657addaf27600c2237e8613ecd91d3

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module MenuDSL
      class ArrayMatchCalculator < MatchCalculator
        def match(query)
          args = { :query => query, :exact_matches => [], :potential_matches => [] }

          pattern.compact.each do |pat|
            pattern_string  = pat.to_s
            query_string    = query.to_s

            if pattern_string == query_string
              args[:exact_matches] << pat
            elsif pattern_string.start_with? query_string
              args[:potential_matches] << pat
            end
          end

          new_calculated_match args
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adhearsion-2.6.4 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.6.3 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.6.2 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.6.1 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.6.0 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb