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.



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

def preserve_raw
  @preserve_raw
end

Instance Method Details

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

Yields:



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

def each
  return to_enum(:each) unless block_given?

  super
  yield :preserve_raw, preserve_raw
end

#fetch(key, *args) ⇒ Object



102
103
104
105
106
107
108
109
# File 'lib/faraday_middleware/response_middleware.rb', line 102

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

#to_hashObject



91
92
93
# File 'lib/faraday_middleware/response_middleware.rb', line 91

def to_hash
  super.update(preserve_raw: preserve_raw)
end