Skip to content

Commit

Permalink
Use each_with_object instead of inject
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Dec 6, 2016
1 parent 0c6c5c9 commit 6253568
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ Style/CollectionMethods:
Style/Documentation:
Enabled: false

Style/DotPosition:
EnforcedStyle: trailing

Style/DoubleNegation:
Enabled: false

Style/EachWithObject:
Enabled: false

Style/Encoding:
Enabled: false

Style/Lambda:
Enabled: false

Style/ModuleFunction:
Enabled: false

Expand Down
4 changes: 2 additions & 2 deletions lib/multi_xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def symbolize_keys(params)
def undasherize_keys(params)
case params
when Hash
params.inject({}) do |hash, (key, value)|
params.each_with_object({}) do |(key, value), hash|
hash[key.to_s.tr('-'.freeze, '_'.freeze)] = undasherize_keys(value)
hash
end
Expand Down Expand Up @@ -283,7 +283,7 @@ def typecast_xml_value(value, disallowed_types = nil) # rubocop:disable AbcSize,
elsif value['type'] && value.size == 1 && !value['type'].is_a?(Hash)
nil
else
xml_value = value.inject({}) do |hash, (k, v)|
xml_value = value.each_with_object({}) do |(k, v), hash|
hash[k] = typecast_xml_value(v, disallowed_types)
hash
end
Expand Down

0 comments on commit 6253568

Please sign in to comment.