Created
December 29, 2010 05:51
-
-
Save msassak/758228 to your computer and use it in GitHub Desktop.
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
$ ruby-1.8.7-p302 method_chain.rb | |
method_chain.rb:2: syntax error, unexpected '.', expecting $end | |
.gsub(/f/, "") | |
^ | |
$ ruby-1.9.2-p0 method_chain.rb | |
OO |
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
puts "foo".gsub(/o/, "O") | |
.gsub(/f/, "") |
I've used the older syntax before, but I hadn't seen anything about the new one. It always bothered me that I had to end the previous line with the dot rather than begin the new one, so I'm happy for the change.
I agree, leaving the dot at the end of the previous line feels awkward especially since I'm used to being able to continue the chain on the next line from javascript development. I'm glad to see the new syntax supported in Ruby 1.9.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed this as well. The way I was able to make this work regardless of the ruby version is to do the following: