Sha256: 3fa93f2b773d9d1b0857ff620ad275fb577bd2b10be1007c2dafbbd771cb582e

Contents?: true

Size: 662 Bytes

Versions: 16

Compression:

Stored size: 662 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.starts_with? query_string
              args[:potential_matches] << pat
            end
          end

          new_calculated_match args
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
adhearsion-2.5.4 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.5.3 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.5.2 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.5.0 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.4.0 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.4.0.beta3 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.4.0.beta2 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.4.0.beta1 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.5 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.4 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.3 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.2 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.1 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.3.0 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.2.1 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb
adhearsion-2.2.0 lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb