To MRI behaviors / When Regexp receive Symbol objects #1873

Merged
merged 2 commits into from Aug 22, 2012

3 participants

@kachick
Rubinius member

Example

MRI/YARV

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

/symbol/ =~ :symbol    # => 0
/symbol/.match :symbol # => #<MatchData "symbol"> 

Rubinius

rubinius 2.0.0dev (1.9.3 af9f288 yyyy-mm-dd JI) [i686-pc-linux-gnu]

/symbol/ =~ :symbol    # => TypeError: Coercion error: :symbol.to_str => String failed
/symbol/.match :symbol # => TypeError: Coercion error: :symbol.to_str => String failed

Suggestion

Cast via Symbol#to_s, just before StringValue()

@travisbot

This pull request passes (merged adb46bc into af9f288).

@dbussink dbussink merged commit efd14a0 into rubinius:master Aug 22, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment