General

Profile

LevLukomskyi (Lev Lukomskyi)

  • Login: LevLukomskyi
  • Registered on: 12/12/2021
  • Last sign in: 08/08/2022

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

08/29/2022

12:40 AM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
> You need to fail when someone passes you garbage (and `nil` is a garbage value in this case), or you need to ensure... LevLukomskyi (Lev Lukomskyi)

08/27/2022

10:13 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
> I also tend to do `**(options || {})` and I don’t write hard-to-read code like `**({id: id, name: name} if id.prese... LevLukomskyi (Lev Lukomskyi)

08/26/2022

11:36 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
> because it’s (1) wasteful
It wastes what? I don't understand this argument
> (2) noisy
This I can understa...
LevLukomskyi (Lev Lukomskyi)
08:43 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
Currently:
```ruby
"xyz".sub(/y/, nil) #=> TypeError: no implicit conversion of nil into String
def nil.to_hash; {} ...
LevLukomskyi (Lev Lukomskyi)

08/25/2022

10:32 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
@austin, your example is a perfect example of "overengineering".
We could argue about "clearness", although about ...
LevLukomskyi (Lev Lukomskyi)
01:17 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
I'm not that much concerned about the performance but about readability. Your solution with `compact` is probably goo... LevLukomskyi (Lev Lukomskyi)
11:36 AM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
> I meant to simply use compact! in a different statement, not in a chain.
If use `compact!` as a different statem...
LevLukomskyi (Lev Lukomskyi)

08/24/2022

08:16 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
2. => more specifically `.tap(&:compact!)` since `compact!` may return `nil` if nothing changed.
3. there might be a...
LevLukomskyi (Lev Lukomskyi)
11:09 AM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
`compact` way looks good indeed, although:
1. it removes all `nil`s from the hash, which might be undesired in some c...
LevLukomskyi (Lev Lukomskyi)

08/08/2022

07:02 PM Ruby master Feature #18959: Handle gracefully nil kwargs eg. **nil
Oh wow, I didn't know that 😲 `def nil.to_hash = {}` works perfectly well! Many thanks! 🙏 LevLukomskyi (Lev Lukomskyi)

Also available in: Atom