Singleton `==` method does not generate valid Ruby
jbodah opened this issue · 3 comments
jbodah commented
Currently using ruby2ruby
(2.3.0) and ruby_processor
(3.8.1) tested with both Ruby 2.1.3 and 2.3.0.
Not sure if the bug is with ruby2ruby
or with ruby_processor
:
irb(main):001:0> class Hello
irb(main):002:1> def self.==(one, two)
irb(main):003:2> one == two
irb(main):004:2> end
irb(main):005:1> end
=> :==
irb(main):006:0> require 'ruby2ruby'
=> true
irb(main):007:0> require 'ruby_parser'
=> true
irb(main):008:0> binding.eval Ruby2Ruby.new.process RubyParser.new.parse("Hello.==(123, 456)")
SyntaxError: (irb):8: syntax error, unexpected ',', expecting ')'
(Hello == 123, 456)
^
from (irb):8:in `eval'
from (irb):8
from /Users/Bodah/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'
jbodah commented
Seems to also happen with other operators like +
zenspider commented
What I currently get:
% cat blah.rb
Hello.==(123, 456)
% rake debug F=blah.rb
(Hello == 123, 456)
zenspider commented
Fixed by @presidentbeef