alanwu (Alan Wu) wrote in #note-2: > Seems to be already addressed by #22097. I see. My quick issue search did not dig it up. I would say `using R; something` is much easier than `-> { something }.refined(R).()`, and we can have both...UlyssesZhan (Ulysses Zhan)
Currently there is `Module#using`. The scope where `using` is effective is the lexical scope of the module eval block (blocks for `module` keyword, `Module::new`, `module_eval`, and `module_exec`). However, since any block is a lexical s...UlyssesZhan (Ulysses Zhan)
Basically `preextend` is equivalent to `singleton_class.prepend`. Since we already have `extend` (basically equivalent to `singleton_class.include`), why not have `preextend`? Related: #6452 #8041UlyssesZhan (Ulysses Zhan)
Personally I have stumbled upon use cases of this method for at least three times. I finally found this feature request. I forgot what I wanted to do the previous times, but the last time I wanted this feature is when I wanted to generat...UlyssesZhan (Ulysses Zhan)
In #17881, it was accepted that `Module#const_added` is called when there is a new constant added to the namespace of the module. Since `main` can also serve as a namespace, it should also be able to use this callback. ```ruby def c...UlyssesZhan (Ulysses Zhan)
``` ruby irb(main):001:0> a = 1 => 1 irb(main):002:0> def f = a => :f irb(main):003:0> f => "D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb" ``` I have not idea what it means. The codes just work fine outside irb. May...UlyssesZhan (Ulysses Zhan)
nobu (Nobuyoshi Nakada) wrote in #note-1: > Read the error message. > ... Read what I wrote: > It should check whether an object responds to to_ary before trying to convert it into an array. I know it used `to_ary` method and got a...UlyssesZhan (Ulysses Zhan)
```ruby def (a = Object.new).method_missing(...) Object.new end [a].flatten # TypeError ``` It should check whether an object responds to `to_ary` before trying to convert it into an array.UlyssesZhan (Ulysses Zhan)
I want to use ```ruby case "str" when /s(?<mid>.)r/ p mid end ``` instead of ```ruby case when /s(?<mid>.)r/ =~ "str" p mid end ``` I also do not like using `$1`. This feature is extremely useful when there are a lot...UlyssesZhan (Ulysses Zhan)
Usually, an UnboundMethod can only be bound to objects of its owner. However, sometimes the limitations can be circumvented. See the following example: ```ruby class A def foo self.class end end class B end module R Bar = ...UlyssesZhan (Ulysses Zhan)