UlyssesZhan (Ulysses Zhan)
- Login: UlyssesZhan
- Email: ulysseszhan@pm.me
- Registered on: 08/16/2019
- Last sign in: 07/19/2023
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 0 | 6 | 6 |
Activity
07/19/2023
-
06:43 AM Ruby Feature #19775 (Closed): Use the callback `main::const_added`
- 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...
02/12/2021
-
09:27 AM Ruby Bug #17623 (Closed): irb starts with some local variables already defined
- ``` 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...
04/21/2020
-
10:37 AM Ruby Bug #16797: Array#flatten not checking `respond_to? :to_ary`
- 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...
04/17/2020
-
10:04 AM Ruby Bug #16797 (Rejected): Array#flatten not checking `respond_to? :to_ary`
- ```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. -
08:23 AM Ruby Feature #16796 (Rejected): Assigning local variables when using `case when regexp`
- 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...
02/09/2020
-
07:59 AM Ruby Bug #16617 (Closed): I can have instance methods bound to objects which are not their owner
- 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 = ...
08/16/2019
-
08:34 AM Ruby Bug #16107 (Closed): Module#refine and Module#using behaved unexpectedly
- The issue happened when I tried to run the code below:
``` ruby
# Main.rb
class A
end
class B
end
module M1
refine A do
def foo *args
puts "foo"
end
end
end
using M1
module M2
def self.enable_foo
refin...