Sha256: 525ffec540dc9404a5adab52d60c4e7e5982237a5095b851f9b13d1856d14572

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

module Adhearsion
  module VoIP
    module DSL
      class DialingDSL
        module MonkeyPatches
          module RegexpMonkeyPatch

            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

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

          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-0.8.6 lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb
adhearsion-0.8.5 lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb
adhearsion-0.8.4 lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb