Sha256: 80460d12d838c4751d58c6dadcead8be5f8b8fc07b0103da6838d98bfbd48f71

Contents?: true

Size: 627 Bytes

Versions: 6

Compression:

Stored size: 627 Bytes

Contents

module Waves

  module Matchers

    class Base
      
      attr_accessor :constraints
      
      def []( *args ) ; call( *args ) ; end
      
      # used to provide consisting matching logic across all matchers
      def test( request )
        constraints.all? do | key, val |
          if val.nil? or val == true
            true
          else
            if val.respond_to? :call
              val.call( request )
            else
              val == request.send( key ) or val === request.send( key ) or request.send( key ) === val
            end
          end
        end
      end
      
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
dyoder-waves-0.8.0 lib/matchers/base.rb
waves-edge-2009.03.10.13.14 lib/matchers/base.rb
waves-stable-2009.3.10 lib/matchers/base.rb
waves-0.8.0 lib/matchers/base.rb
waves-0.8.1 lib/matchers/base.rb
waves-0.8.2 lib/matchers/base.rb