Sha256: e25903ee3d02fd66396bdb8911eaa46194ac3077108449b4e08ba536646f93b5

Contents?: true

Size: 459 Bytes

Versions: 6

Compression:

Stored size: 459 Bytes

Contents

module Waves

  module Matchers

    class Query < Base
      
      def initialize( pattern ) ; @pattern = ( pattern or {} ) ; end
    
      def call( request )
        @pattern.all? do | key, val |
          key = key.to_s
          ( ( val.respond_to?(:call) and val.call( request.query[ key ] ) ) or 
            ( request.query[ key ] and ( ( val == true ) or ( val === request.query[ key ] ) ) ) )
        end
      end
      
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 4 rubygems

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