# File lib/excon/headers.rb, line 21 def [](key) if should_delegate?(key) @downcased[key.downcase] else raw_reader(key) end end
# File lib/excon/headers.rb, line 30 def []=(key, value) raw_writer(key, value) unless @downcased.nil? @downcased[key.downcase] = value end end
# File lib/excon/headers.rb, line 38 def assoc(obj) if should_delegate?(obj) @downcased.assoc(obj.downcase) else raw_assoc(obj) end end
# File lib/excon/headers.rb, line 47 def delete(key, &proc) if should_delegate?(key) @downcased.delete(key.downcase, &proc) else raw_delete(key, &proc) end end
# File lib/excon/headers.rb, line 55 def fetch(key, default = nil, &proc) if should_delegate?(key) if proc @downcased.fetch(key.downcase, &proc) else @downcased.fetch(key.downcase, default) end else if proc raw_fetch(key, &proc) else raw_fetch(key, default) end end end
# File lib/excon/headers.rb, line 73 def has_key?(key) raw_has_key?(key) || begin index_case_insensitive @downcased.has_key?(key.downcase) end end
# File lib/excon/headers.rb, line 80 def rehash raw_rehash if @downcased @downcased.rehash end end
# File lib/excon/headers.rb, line 87 def values_at(*keys) raw_values_at(*keys).zip(keys).map do |v, k| if v.nil? index_case_insensitive @downcased[k.downcase] end end end
# File lib/excon/headers.rb, line 107 def index_case_insensitive if @downcased.nil? @downcased = {} each_pair do |key, value| @downcased[key.downcase] = value end end end
# File lib/excon/headers.rb, line 98 def should_delegate?(key) if raw_has_key?(key) false else index_case_insensitive true end end