`Array#uniq` doesn't evaluate the given block when the size of the array is one. Is this expected behavior? ``` $ ruby -e '[42, 43].uniq { _1.foo }; puts true' -e:1:in `block in <main>': undefined method `foo' for 42:Integer (NoMeth...ttanimichi (Tsukuru Tanimichi)
It's a lot of work to write `sort_by { -1 * _1.created_at.to_f }` when the target objects are `Time` instances. ```ruby ['foo', 'bar', 'baz'].map { search(_1) }.flatten.sort_by { -1 * _1.created_at.to_f } def search(query) clie...ttanimichi (Tsukuru Tanimichi)
I know you can't `instance_exec` a proc which is generated by `Method#to_proc` because it has its original instance's context. But, in such a case, raising `ArgumentError` would be the ideal behavior. ```ruby f = -> (x) { a + x } ...ttanimichi (Tsukuru Tanimichi)
```ruby func1 = -> (x) { x + y } class A def y 10 end end A.new.instance_exec(1, &func1) # => 11 func2 = -> (x) { x * 2 } f = func1 >> func2 A.new.instance_exec(1, &f) # => undefined local variable or method `y' f...ttanimichi (Tsukuru Tanimichi)
Hi, I like this idea! This feature would be quite useful when you get `NoMethodError` in the production environment and error tracking tools like [Sentry](https://sentry.io/welcome/) inform you of that error. Consider the example I've at...ttanimichi (Tsukuru Tanimichi)
`struct = (a: 1, b: 2)` would be a great syntax, because I think anonymous struct is something like Tuple of Python. But, there are two problems: 1. `()` returns `nil`, not an empty struct. 2. The meaning of `p(a: 1)` and `p (a: 1)...ttanimichi (Tsukuru Tanimichi)
This error don't reproduce in Ruby 2.5.0 but reproduce in 2.5.1 ~~~ $ bundle ex rspec /Users/tanimichi.tsukuru/ghq/github.com/moneyforward/moneyplus/vendor/bundle/ruby/2.5.0/gems/pg-0.21.0/lib/pg.rb:56: [BUG] Segmentation fault at 0...ttanimichi (Tsukuru Tanimichi)