diff options
| author | mokha <mokha@cisco.com> | 2019-04-27 11:39:48 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-04-27 11:39:48 -0600 |
| commit | d904b0d087eedfcd1bfc092c587701ca21250265 (patch) | |
| tree | 892b0bbc5858629642b2cd256963ce6ef44b4958 | |
| parent | 10e82cb9e1b9f5c9b3672b8c32bd6bc0473b37b0 (diff) | |
inline ternary operator in array indexermain
| -rw-r--r-- | spec/practice/luhn_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/practice/luhn_spec.rb b/spec/practice/luhn_spec.rb index 964888b..6303319 100644 --- a/spec/practice/luhn_spec.rb +++ b/spec/practice/luhn_spec.rb @@ -31,7 +31,7 @@ class Luhn def self.partition(digits) digits.each_with_index.inject([[], []]) do |memo, (digit, index)| - index.even? ? memo[0].push(digit) : memo[1].push(digit) + memo[index.even? ? 0 : 1].push(digit) memo end end |
