General

Profile

Soilent (Konstantin x)

  • Login: Soilent
  • Registered on: 11/22/2013
  • Last sign in: 05/11/2024

Issues

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

Activity

05/12/2024

06:08 AM Ruby Bug #20482: nil variables in a guard clause of a standalone => or in expression
Thank you, nobu! That explains it.
Just to clarify, is this how the expression is parsed?
```ruby
( [1, 2] in a, b ) if b == 2*a
```
And since this is a modifier `if`, the parser creates variables a and b first, which is why t...
Soilent (Konstantin x)

05/11/2024

04:45 PM Ruby Bug #20482 (Closed): nil variables in a guard clause of a standalone => or in expression

The following expression produces a TypeError, which is quite unexpected:
```ruby
[1, 2] in a, b if b == 2*a
```
```
x.rb:1:in `*': nil can't be coerced into Integer (TypeError)
[1, 2] in a, b if b == 2*a
...
Soilent (Konstantin x)

12/23/2020

10:39 PM Ruby Bug #17430: CSV: NoMethodError when the write_nil_value or write_empty_value options are used
kou (Kouhei Sutou) wrote in #note-1:
> It has been fixed in the latest csv gem.
> ...
Thank you!
Soilent (Konstantin x)
06:43 AM Ruby Bug #17430 (Closed): CSV: NoMethodError when the write_nil_value or write_empty_value options are used
CSV.generate_line throws an exception when I specify `write_nil_value` or `write_nil_value`.
```
> CSV.generate_line [1,nil,3]
=> "1,,3\n"
> ...
Traceback (most recent call last):
12: from /usr/bin/irb:23:in `<main>'
...
Soilent (Konstantin x)

12/10/2019

05:32 AM Ruby Revision 1bdabaa6 (git): base64.rb: improve performance of Base64.urlsafe_encode64
* lib/base64.rb: avoid unnecessary memory allocations Soilent (Konstantin x)

03/08/2018

11:59 AM Ruby Feature #14580: Hash#store accepts a block
Eregon (Benoit Daloze) wrote:
> Soilent (Konstantin x) wrote:
> ...
I see your point, but the example was not about String to Time caching. Let's say you receive an HTTP POST request with the body `timestamp=2018-03-08T11:24:44Z&temper...
Soilent (Konstantin x)
11:05 AM Ruby Feature #14580: Hash#store accepts a block
mame (Yusuke Endoh) wrote:
> I think it is not so simple to optimize the double lookup by this API. Consider:
> ...
I think that an exception should be thrown if the block modifies the hash.
Soilent (Konstantin x)
08:44 AM Ruby Feature #14580: Hash#store accepts a block
sawa (Tsuyoshi Sawada) wrote:
> Why not write `hash[:a]+= 42`?
Good point, but this works only for arithmetic operators (and also does 2 key lookups). Consider another example `hash.store(:time) { |ts| Time.parse(ts) }`
Soilent (Konstantin x)

03/07/2018

04:40 PM Ruby Feature #14580: Hash#store accepts a block
Hanmac (Hans Mackowiak) wrote:
> ~~~ ruby
> ...
Thanks for the question.
I think that `hash.store(:b)` should yield the default value if the key does not exist, i.e. option b.
But in case of `hash.transform_values(:a, :b)`, when we...
Soilent (Konstantin x)
04:25 PM Ruby Feature #14580: Hash#store accepts a block
Eregon (Benoit Daloze) wrote:
> What should happen if the given key doesn't exist in Hash?
> ...
Good question, thank you. I think, the result of default_proc or the default value should be yielded.
Soilent (Konstantin x)

Also available in: Atom