Class: Adhearsion::VoIP::DSL::DialingDSL::RouteRule
- Defined in:
- lib/adhearsion/voip/dsl/dialing_dsl.rb
Defined Under Namespace
Classes: RouteException
Instance Attribute Summary collapse
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
Instance Method Summary collapse
- #===(other) ⇒ Object
- #>>(other) ⇒ Object
-
#initialize(hash = {}) ⇒ RouteRule
constructor
A new instance of RouteRule.
- #merge!(other) ⇒ Object
- #unshift_pattern(pattern) ⇒ Object
- #|(other) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ RouteRule
Returns a new instance of RouteRule.
106 107 108 109 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 106 def initialize(hash={}) @patterns = Array hash[:patterns] @providers = Array hash[:providers] end |
Instance Attribute Details
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
104 105 106 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 104 def patterns @patterns end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
104 105 106 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 104 def providers @providers end |
Instance Method Details
#===(other) ⇒ Object
136 137 138 139 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 136 def ===(other) patterns.each { |pattern| return true if pattern === other } false end |
#>>(other) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 117 def >>(other) case other when RouteRule then merge! other when ProviderDefinition then providers << other else raise RouteException, "Unrecognized object in route definition: #{other.inspect}" end self end |
#merge!(other) ⇒ Object
111 112 113 114 115 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 111 def merge!(other) providers.concat other.providers patterns.concat other.patterns self end |
#unshift_pattern(pattern) ⇒ Object
141 142 143 |
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 141 def unshift_pattern(pattern) patterns.unshift pattern end |