Module: FaradayMiddleware::OptionsExtension

Defined in:
lib/faraday_middleware/response_middleware.rb

Overview

DRAGONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#preserve_rawObject

Returns the value of attribute preserve_raw.



81
82
83
# File 'lib/faraday_middleware/response_middleware.rb', line 81

def preserve_raw
  @preserve_raw
end

Instance Method Details

#each {|:preserve_raw, preserve_raw| ... } ⇒ Object

Yields:



87
88
89
90
91
# File 'lib/faraday_middleware/response_middleware.rb', line 87

def each
  return to_enum(:each) unless block_given?
  super
  yield :preserve_raw, preserve_raw
end

#fetch(key, *args) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/faraday_middleware/response_middleware.rb', line 93

def fetch(key, *args)
  if :preserve_raw == key
    value = __send__(key)
    value.nil? ? args.fetch(0) : value
  else
    super
  end
end

#to_hashObject



83
84
85
# File 'lib/faraday_middleware/response_middleware.rb', line 83

def to_hash
  super.update(:preserve_raw => preserve_raw)
end