Last active
November 28, 2016 18:28
-
-
Save maxim/c806779bf2d743ea3adefc08cfff3532 to your computer and use it in GitHub Desktop.
Strange ruby bug: can't put comment after linebreak in method args. Tested in 2.3.2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo \ | |
a: 'a', | |
# comment here is ok | |
b: 'b' | |
puts a, b | |
end | |
foo(a: 'a', b: 'b') # => a\nb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo \ | |
# comment here causes error | |
a: 'a', | |
b: 'b' | |
puts a, b | |
end | |
foo(a: 'a', b: 'b') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see what you mean. Yeah, makes sense to allow \ to skip comments. Especially since you can't use \ in a comment to further continue.