Sha256: c1a273367c91e6d02c871d7a57d0264acc79bb727561d3d087505d301a4a8ce6

Contents?: true

Size: 809 Bytes

Versions: 35

Compression:

Stored size: 809 Bytes

Contents

module HtmlUnit
  # Reopen HtmlUnit's HttpMethod class to add convenience methods.
  class HttpMethod

    # Loosely compare HttpMethod with another object, accepting either an
    # HttpMethod instance or a symbol describing the method. Note that :any is a
    # special symbol which will always return true.
    #
    # @param [HttpMethod] other an HtmlUnit HttpMethod object
    # @param [Symbol] other a symbolized representation of an http method
    # @return [true/false]
    def ===(other)
      case other
      when HttpMethod
        super
      when :any
        true
      when :get
        self == self.class::GET
      when :post
        self == self.class::POST
      when :put
        self == self.class::PUT
      when :delete
        self == self.class::DELETE
      end
    end

  end
end

Version data entries

35 entries across 35 versions & 7 rubygems

Version Path
akephalos2-2.1.3-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.3 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.2-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.2 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1.2-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1.2 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-stable-2.1.1.1 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1.1-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1.1 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.1 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.0-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.1.0 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.9-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.9 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.8.1-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.8.1 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.8-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.8 lib/akephalos/htmlunit/ext/http_method.rb
akephalos2-2.0.7-java lib/akephalos/htmlunit/ext/http_method.rb