Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor HashLiteral#swap to use less temporary variables

  • Loading branch information...
commit 0d08197e6a76c86316689a9559f40a3b6aef41b2 1 parent 0a570bb
@dkubb dkubb authored
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/mutant/literal.rb
View
7 lib/mutant/literal.rb
@@ -84,13 +84,10 @@ def swap
class HashLiteral < BaseLiteral
def swap
- new_body = @node.array.each_slice(2).inject([]) do |body, array|
- key, value = array
+ new_body = @node.array.each_slice(2).inject([]) do |body, (key, value)|
new_value = literal_class(value).new(value.clone).swap
- body.push key
- body.push new_value
- body
+ body << key << new_value
end
@node.array = new_body
Please sign in to comment.
Something went wrong with that request. Please try again.