diff options
| author | INOUE Yasuyuki <[email protected]> | 2014-09-18 16:07:27 +0900 |
|---|---|---|
| committer | INOUE Yasuyuki <[email protected]> | 2014-09-18 16:07:27 +0900 |
| commit | e66d86a5fb8ab79403ab47423f9a871fdc5b26fb (patch) | |
| tree | 95c38f7e7c10b3ed5ec3fcb48e49bfdcb6285860 /mrbgems/mruby-hash-ext | |
| parent | 5603b8d79f3726466fdab60905c16439b59c6c3e (diff) | |
| download | mruby-e66d86a5fb8ab79403ab47423f9a871fdc5b26fb.tar.gz mruby-e66d86a5fb8ab79403ab47423f9a871fdc5b26fb.zip | |
refactor Hash generator loop
Diffstat (limited to 'mrbgems/mruby-hash-ext')
| -rw-r--r-- | mrbgems/mruby-hash-ext/mrblib/hash.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 6546af644..891aae27d 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -29,8 +29,7 @@ class Hash end raise ArgumentError, 'odd number of arguments for Hash' unless object.length % 2 == 0 h = Hash.new - t = (0...(object.length >> 1)).map { |i| i * 2 } - for i in t do + 0.step(object.length - 2, 2) do |i| h[object[i]] = object[i + 1] end h |
