Class: Adhearsion::VoIP::FixnumMatchCalculator

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



96
97
98
99
100
101
102
103
104
105
# File 'lib/adhearsion/voip/menu_state_machine/matchers.rb', line 96

def match(query)
  numeric_query = coerce_to_numeric query
  exact_match, potential_match = nil
  if pattern == numeric_query
    exact_match = pattern
  elsif pattern.to_s.starts_with? query.to_s
    potential_match = pattern
  end
  new_calculated_match :query => query, :exact_matches => exact_match, :potential_matches => potential_match
end