Issue #8205 has been updated by nagachika (Tomoyuki Chikanaga).

Category set to doc
Status changed from Feedback to Assigned
Assignee set to zzak (Zachary Scott)
Target version set to current: 2.1.0

Hello, avyy.

That makes sense.
I think it's spec that Regexp.union internally convert arguments with to_regexp, but it is undocumented behavior. I think it's a documentation issue.
----------------------------------------
Bug #8205: Regexp.union behavior and Regexp.try_convert
https://bugs.ruby-lang.org/issues/8205#change-41776

Author: avyy (Alexander Yunin)
Status: Assigned
Priority: Low
Assignee: zzak (Zachary Scott)
Category: doc
Target version: current: 2.1.0
ruby -v: 1.9.3p374
Backport: 


Hi! Why Regexp.union('/../') trying to convert string with directly call rb_check_regexp_type(arg) (re.c:3139) instead of rb_reg_s_try_convert (re.c:3122)? I think second variant would be more correct, and i would be able to rewrite Regexp.try_convert in my code for changing behavior as i need. 
For example: i have the code where was implemented String#to_regexp which breaks default behavior of Regexp.union and i got incorrect regexp. But i can't (for some reasons) to rewrite to_regexp method. Yes, stupid example, but it's real situation.


-- 
http://bugs.ruby-lang.org/