Class: Adhearsion::VoIP::StringMatchCalculator

Inherits:
MatchCalculator show all
Defined in:
lib/adhearsion/voip/menu_state_machine/matchers.rb

Instance Attribute Summary

Attributes inherited from MatchCalculator

#match_payload, #pattern

Instance Method Summary collapse

Methods inherited from MatchCalculator

build_with_pattern, inherited, #initialize

Constructor Details

This class inherits a constructor from Adhearsion::VoIP::MatchCalculator

Instance Method Details

#match(query) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/adhearsion/voip/menu_state_machine/matchers.rb', line 109

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