Class: HtmlUnit::HttpMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/akephalos/htmlunit/ext/http_method.rb

Overview

Reopen HtmlUnit’s HttpMethod class to add convenience methods.

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ true/false

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.

Parameters:

  • other (HttpMethod)

    an HtmlUnit HttpMethod object

  • other (Symbol)

    a symbolized representation of an http method

Returns:

  • (true/false)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/akephalos/htmlunit/ext/http_method.rb', line 12

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