Parent

Methods

Object::Mashify

Public: Converts parsed response bodies to a Hashie::Mash if they were of Hash or Array type.

Attributes

mash_class[RW]
mash_class[RW]

Public Class Methods

new(app = nil, options = {}) click to toggle source
# File lib/faraday_middleware/response/mashify.rb, line 18
def initialize(app = nil, options = {})
  super(app)
  self.mash_class = options[:mash_class] || self.class.mash_class
end

Public Instance Methods

parse(body) click to toggle source
# File lib/faraday_middleware/response/mashify.rb, line 23
def parse(body)
  case body
  when Hash
    mash_class.new(body)
  when Array
    body.map { |item| parse(item) }
  else
    body
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.