Class: Adhearsion::VoIP::CalculatedMatchCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/menu_state_machine/calculated_match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCalculatedMatchCollection

Returns a new instance of CalculatedMatchCollection.



45
46
47
48
49
50
51
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 45

def initialize
  @calculated_matches       = []
  @potential_matches        = []
  @exact_matches            = []
  @actual_potential_matches = []
  @actual_exact_matches     = []
end

Instance Attribute Details

#actual_exact_matchesObject (readonly)

Returns the value of attribute actual_exact_matches.



42
43
44
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 42

def actual_exact_matches
  @actual_exact_matches
end

#actual_potential_matchesObject (readonly)

Returns the value of attribute actual_potential_matches.



42
43
44
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 42

def actual_potential_matches
  @actual_potential_matches
end

#calculated_matchesObject (readonly)

Returns the value of attribute calculated_matches.



42
43
44
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 42

def calculated_matches
  @calculated_matches
end

#exact_matchesObject (readonly)

Returns the value of attribute exact_matches.



42
43
44
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 42

def exact_matches
  @exact_matches
end

#potential_matchesObject (readonly)

Returns the value of attribute potential_matches.



42
43
44
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 42

def potential_matches
  @potential_matches
end

Instance Method Details

#<<(calculated_match) ⇒ Object



53
54
55
56
57
58
59
60
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 53

def <<(calculated_match)
  calculated_matches << calculated_match
  actual_potential_matches.concat calculated_match.potential_matches
  actual_exact_matches.concat calculated_match.exact_matches
  
  potential_matches << calculated_match if calculated_match.potential_match?
  exact_matches << calculated_match if calculated_match.exact_match?
end

#exact_match?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 74

def exact_match?
  exact_match_count > 0
end

#exact_match_countObject



66
67
68
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 66

def exact_match_count
  actual_exact_matches.size
end

#potential_match?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 70

def potential_match?
  potential_match_count > 0
end

#potential_match_countObject



62
63
64
# File 'lib/adhearsion/voip/menu_state_machine/calculated_match.rb', line 62

def potential_match_count
  actual_potential_matches.size
end