Permalink
Browse files

Rename finished_env -> response for clarity

  • Loading branch information...
1 parent dc78b08 commit 98ecbb93e667342f0a814998576abe0ad5f32556 @sferik sferik committed Sep 28, 2010
Showing with 8 additions and 8 deletions.
  1. +4 −4 lib/faraday/mashify.rb
  2. +4 −4 lib/faraday/multi_json.rb
View
@@ -4,12 +4,12 @@ class Response::Mashify < Response::Middleware
require 'hashie'
def self.register_on_complete(env)
- env[:response].on_complete do |finished_env|
- json = finished_env[:body]
+ env[:response].on_complete do |response|
+ json = response[:body]
if json.is_a?(Hash)
- finished_env[:body] = Hashie::Mash.new(json)
+ response[:body] = Hashie::Mash.new(json)
elsif json.is_a?(Array) and json.first.is_a?(Hash)
- finished_env[:body] = json.map{|item| Hashie::Mash.new(item) }
+ response[:body] = json.map{|item| Hashie::Mash.new(item) }
end
end
end
@@ -4,17 +4,17 @@ class Response::MultiJson < Response::Middleware
require 'multi_json'
def self.register_on_complete(env)
- env[:response].on_complete do |finished_env|
- finished_env[:body] = begin
- case finished_env[:body]
+ env[:response].on_complete do |response|
+ response[:body] = begin
+ case response[:body]
when ""
nil
when "true"
true
when "false"
false
else
- MultiJson.decode(finished_env[:body])
+ MultiJson.decode(response[:body])
end
end
end

0 comments on commit 98ecbb9

Please sign in to comment.