+1 for the idea, I'm using my_hash.fetch(:my_key) to ensure consistency in a lot of places. Concerns: 1. Struct is slow (should not be that hard to improve, though) 2. ${} will be hard to read, search and explain about 3. It woul...sobrinho (Gabriel Sobrinho)
Suggestion: TrueClass and FalseClass inheriting from Boolean (new superclass). This would make true/false checking easier, like: ``` unless value.is_a?(Boolean) raise "Non-boolean value" end ``` Currently we have to check ...sobrinho (Gabriel Sobrinho)
When all elements are returned on select!, the method returns nil. ~~~ (main) normal> [1,2,3].select! { |x| x == 0 } => [] (main) normal> [1,2,3].select! { |x| x == 1 } => [1] (main) normal> [1,2,3].select! { |x| x == 1 || x == 2...sobrinho (Gabriel Sobrinho)
At the begin of DST ruby is accepting the 0 hour which in fact doesn't exists: Time.local(2014, 10, 19, 0, 30) #=> 2014-10-19 01:30:00 -0200 Time.local(2014, 10, 19, 1, 30) #=> 2014-10-19 01:30:00 -0200 Tim...sobrinho (Gabriel Sobrinho)
Hello guys, I would to suggest us to discuss about implementing implicit interfaces on Ruby like Go. > Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list ...sobrinho (Gabriel Sobrinho)
Maybe I'm too late but why not use the same object when calling String#freeze? I mean, currently this: > "something".freeze.object_id => 70273877530260 > "something".freeze.object_id => 70273877536840 And change the c...sobrinho (Gabriel Sobrinho)