Class: Mechanize::Headers

Inherits:
Hash
  • Object
show all
Defined in:
lib/mechanize/headers.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object


3
4
5
# File 'lib/mechanize/headers.rb', line 3

def [](key)
  super(key.downcase)
end

#[]=(key, value) ⇒ Object


7
8
9
# File 'lib/mechanize/headers.rb', line 7

def []=(key, value)
  super(key.downcase, value)
end

#canonical_eachObject


15
16
17
18
19
20
21
22
# File 'lib/mechanize/headers.rb', line 15

def canonical_each
  block_given? or return enum_for(__method__)
  each { |key, value|
    key = key.capitalize
    key.gsub!(/-([a-z])/) { "-#{$1.upcase}" }
    yield [key, value]
  }
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)

11
12
13
# File 'lib/mechanize/headers.rb', line 11

def key?(key)
  super(key.downcase)
end