jeremyevans0 (Jeremy Evans) wrote in #note-2: > I think a `RangeError` is more correct. Without having a beginning, you cannot know the increment value, and therefore cannot know the maximum value. People that want the end of the rang...citizen428 (Michael Kohl)
citizen428 (Michael Kohl) wrote: > I think this is not ideal. Possible solutions: > ... I had some time and looked into this. For inclusive integer ranges `r.end` will now be returned, no other behavior changes. Patch attached, but sin...citizen428 (Michael Kohl)
When calling `max` on a beginless range, a non-intuitive error gets raised: ``` ruby r = ..9 r.max # ArgumentError: comparison of NilClass with 9 failed ``` There's a check for `NIL_P(RANGE_BEG(range))` but it's inside another ...citizen428 (Michael Kohl)
Koichi Sasada wrote: > Basically, I like this proposal. > ... In that case, how about making `Symbol#to_proc` accept additional arguments? ~~~ruby (1..3).map(:+, 2) ~~~ The syntax would be very straightforward, but it doesn't...citizen428 (Michael Kohl)
After a discussion in our team chat today, I wondered if it would be a good idea to have a version of String.new that accepts a block and works as a string builder. Something like string = String.new("foo") do |s| s << "bar...citizen428 (Michael Kohl)
claytrump (Clay Trump) wrote: > There is no "extract!" in ActiveSupport, its "slice!" you mean. http://apidock.com/rails/Hash/extract%21 # File activesupport/lib/active_support/core_ext/hash/slice.rb, line 35 def extract!(*key...citizen428 (Michael Kohl)
claytrump (Clay Trump) wrote: > Isn't that like the method slice in ActiveSupport? It's definitely like extract! in ActiveSupport, just non-destructive. I still think this is useful enough to be in core though. I needed it repeatedly...citizen428 (Michael Kohl)
I often need a method to extract "subhashes" from hashes. I often monkey-patched this into hash and found "extract" to be a good name for the method. Afterwards I found out that there actually is a mutating method called "extract!" in Ac...citizen428 (Michael Kohl)
I know that what I propose here is a significant change to Ruby, but it's part of my ongoing quest to get some more functional programming features into Ruby (see also #4539 and #6373). I was wondering if it would make sense to maybe...citizen428 (Michael Kohl)