Sha256: 4173645f2706b7da44242a87fecd52fb12b8cb4a7f592deb6769576f0f39a05d

Contents?: true

Size: 611 Bytes

Versions: 5

Compression:

Stored size: 611 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module MenuDSL
      class StringMatchCalculator < MatchCalculator

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

          pattern_string  = pattern.to_s
          query_string    = query.to_s

          if pattern_string == query_string
            args[:exact_matches] = [pattern]
          elsif pattern_string.start_with? query_string
            args[:potential_matches] = [pattern]
          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/string_match_calculator.rb
adhearsion-2.6.3 lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb
adhearsion-2.6.2 lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb
adhearsion-2.6.1 lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb
adhearsion-2.6.0 lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb