Sha256: fcee8182ad0a2382f0eb485116306aa02c29daaaa2e49499135678f546e792c3

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

# Reopen com.gargoylesoftware.htmlunit.HttpMethod 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
akephalos-0.2.4-java lib/akephalos/htmlunit/ext/http_method.rb
akephalos-0.2.4 lib/akephalos/htmlunit/ext/http_method.rb