Multi Line Comments in Ruby - Finally
source link: https://fuzzyblog.io/blog/ruby/2017/02/26/multi-line-comments-in-ruby-finally.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Multi Line Comments in Ruby - Finally
Feb 26, 2017
I've wanted multi line comments in Ruby forever and I just, thanks to this Stack Overflow post, found out that they exist thanks to =begin and =end:
=begin
A long comment
that spans two
lines
=end
Here's a practical example where I'm keeping an example of how to run an instance method on a class in an easy to use copy and paste fashion (copy it and just drop it in Rails console).
=begin
url = "https://www.etsy.com/listing/253953555/tacos-tshirt-perfect-for-tacos-lover?ref=finds_l"
parser = Page.new(url)
parser.parse
=end
I'm a fan of keeping code snippets around for easy copy and paste so you can get back to stuff quickly and multi-line comments make that so, so much easier. Sure, I'd prefer /* and */, but, honestly, this will make me happy. Matz made a choice to not have multi-line comments and while I don't personally agree, long ago, I tied my
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK