Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use each_object_with instead of inject

Issue #98
  • Loading branch information...
commit 68793d275d490881fe3b26269708afe7e78277cb 1 parent 0242d1c
@greyblake greyblake authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/virtus/attribute/hash.rb
View
5 lib/virtus/attribute/hash.rb
@@ -91,10 +91,9 @@ def initialize(*)
# @api private
def coerce(value)
coerced = super
- return coerced unless coerced.respond_to?(:inject)
- coerced.inject(new_hash) do |hash, key_and_value|
+ return coerced unless coerced.respond_to?(:each_with_object)
+ coerced.each_with_object(new_hash) do |key_and_value, hash|
hash[key_and_value[0]] = key_and_value[1]
- hash
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.