class Faraday::Options

a Struct.
Subclasses Struct with some special helpers for converting from a Hash to

def self.attribute_options

Internal
def self.attribute_options
  @attribute_options ||= {}
end

def self.from(value)

Public
def self.from(value)
  value ? new.update(value) : new
end

def self.options(mapping)

Internal
def self.options(mapping)
  attribute_options.update(mapping)
end

def self.options_for(key)

Internal
def self.options_for(key)
  attribute_options[key]
end

def delete(key)

Public
def delete(key)
  value = send(key)
  send("#{key}=", nil)
  value
end

def each(&block)

Public
def each(&block)
  members.each do |key|
    block.call key.to_sym, send(key)
  end
end

def fetch(key, default = nil)

Public
def fetch(key, default = nil)
  send(key) || send("#{key}=", default ||
    (block_given? ? Proc.new.call : nil))
end

def inspect

Internal
def inspect
  values = []
  members.each do |m|
    value = send(m)
    values << "#{m}=#{value.inspect}" if value
  end
  values = values.empty? ? ' (empty)' : (' ' << values.join(", "))
  %(#<#{self.class}#{values}>)
end

def keys

Public
def keys
  members.reject { |m| send(m).nil? }
end

def merge(value)

Public
def merge(value)
  dup.update(value)
end

def to_hash

Public
def to_hash
  hash = {}
  members.each do |key|
    value = send(key)
    hash[key.to_sym] = value if value
  end
  hash
end

def update(obj)

Public
def update(obj)
  obj.each do |key, value|
    next unless value
    sub_options = self.class.options_for(key)
    if sub_options && value
      value = sub_options.from(value)
    elsif Hash === value
      hash = {}
      value.each do |hash_key, hash_value|
        hash[hash_key] = hash_value
      end
      value = hash
    end
    self.send("#{key}=", value)
  end
  self
end

def values_at(*keys)

Public
def values_at(*keys)
  keys.map { |key| send(key) }
end