Class: Adhearsion::VoIP::CallRouting::Router
- Defined in:
- lib/adhearsion/voip/call_routing.rb
Class Attribute Summary collapse
-
.rules ⇒ Object
Returns the value of attribute rules.
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Class Method Summary collapse
Instance Method Summary collapse
- #define(&block) ⇒ Object
-
#initialize ⇒ Router
constructor
A new instance of Router.
- #route(*args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Router
Returns a new instance of Router.
50 51 52 |
# File 'lib/adhearsion/voip/call_routing.rb', line 50 def initialize @rules = [] end |
Class Attribute Details
.rules ⇒ Object
Returns the value of attribute rules.
31 32 33 |
# File 'lib/adhearsion/voip/call_routing.rb', line 31 def rules @rules end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
49 50 51 |
# File 'lib/adhearsion/voip/call_routing.rb', line 49 def rules @rules end |
Class Method Details
.calculate_route_for(end_point) ⇒ Object
40 41 42 43 44 |
# File 'lib/adhearsion/voip/call_routing.rb', line 40 def calculate_route_for(end_point) if rule = rules[end_point.to_s] rule.providers end end |
.define(&block) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/adhearsion/voip/call_routing.rb', line 33 def define(&block) returning new do |router| router.define(&block) rules.concat router.rules end end |
Instance Method Details
#define(&block) ⇒ Object
54 55 56 |
# File 'lib/adhearsion/voip/call_routing.rb', line 54 def define(&block) instance_eval(&block) end |