Module: Adhearsion::VoIP::DSL::DialingDSL::MonkeyPatches::RegexpMonkeyPatch

Defined in:
lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb

Instance Method Summary collapse

Instance Method Details

#>>(other) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb', line 20

def >>(other)
  case other
    when ProviderDefinition
      RouteRule.new :patterns => self, :providers => other
    when RouteRule
      other.tap do |route|
        route.unshift_pattern self
      end
    else raise ArgumentError, "Unsupported route definition #{other.inspect}"
  end
end

#|(other) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb', line 8

def |(other)
  case other
    when RouteRule
      other.unshift_pattern self
      other
    when Regexp
      RouteRule.new :patterns => [self, other]
    else
      raise ArgumentError, "Unsupported pattern type #{other.inspect}"
  end
end