Class: FastCurl::Headers

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

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/fast_curl.rb', line 12

def [](key)
  super(normalize(key))
end

#[]=(key, value) ⇒ Object Also known as: store



16
17
18
# File 'lib/fast_curl.rb', line 16

def []=(key, value)
  super(normalize(key), value)
end

#assoc(key) ⇒ Object



44
45
46
# File 'lib/fast_curl.rb', line 44

def assoc(key)
  super(normalize(key))
end

#delete(key, &block) ⇒ Object



32
33
34
# File 'lib/fast_curl.rb', line 32

def delete(key, &block)
  super(normalize(key), &block)
end

#dig(key, *rest) ⇒ Object



36
37
38
# File 'lib/fast_curl.rb', line 36

def dig(key, *rest)
  super(normalize(key), *rest)
end

#fetch(key, *args, &block) ⇒ Object



21
22
23
# File 'lib/fast_curl.rb', line 21

def fetch(key, *args, &block)
  super(normalize(key), *args, &block)
end

#key?(key) ⇒ Boolean Also known as: has_key?, include?, member?

Returns:

  • (Boolean)


25
26
27
# File 'lib/fast_curl.rb', line 25

def key?(key)
  super(normalize(key))
end

#merge(*others, &block) ⇒ Object



48
49
50
# File 'lib/fast_curl.rb', line 48

def merge(*others, &block)
  others.inject(dup) { |acc, other| acc.merge!(other, &block) }
end

#merge!(*others) ⇒ Object Also known as: update



52
53
54
55
56
57
58
59
# File 'lib/fast_curl.rb', line 52

def merge!(*others)
  others.each do |other|
    other.each do |key, value|
      self[key] = block_given? && key?(key) ? yield(normalize(key), self[key], value) : value
    end
  end
  self
end

#values_at(*keys) ⇒ Object



40
41
42
# File 'lib/fast_curl.rb', line 40

def values_at(*keys)
  super(*keys.map { |key| normalize(key) })
end