class ActiveRestClient::HeadersList
Constants
- STORE_MULTIPLE_VALUES
Public Class Methods
new()
click to toggle source
# File lib/active_rest_client/headers_list.rb, line 4 def initialize @store = {} end
Public Instance Methods
[](key)
click to toggle source
# File lib/active_rest_client/headers_list.rb, line 18 def [](key) key = find_existing(key) @store[key] end
[]=(key,value)
click to toggle source
# File lib/active_rest_client/headers_list.rb, line 8 def []=(key,value) key = find_existing(key) if STORE_MULTIPLE_VALUES.include?(key.downcase) @store[key] ||= [] @store[key] << value else @store[key] = value end end
each(split_multiple_headers = false) { |key, inner_value| ... }
click to toggle source
# File lib/active_rest_client/headers_list.rb, line 23 def each(split_multiple_headers = false) @store.keys.each do |key| value = @store[key] if value.is_a?(Array) && split_multiple_headers value.each do |inner_value| yield(key, inner_value) end else yield(key, value) end end end
Private Instance Methods
find_existing(key)
click to toggle source
# File lib/active_rest_client/headers_list.rb, line 38 def find_existing(key) key_downcase = key.downcase @store.keys.each do |found_key| return found_key if found_key.downcase == key_downcase end key end