I'm making a Ruby gem, and I want to put comments in the file. Would this be allowed, or would it mess up the gem? My code:
# test
Gem::Specification.new do |s|
s.name = 'My Gem' # Add a better name
s.version = '0.0.0'
s.summary = "Summary of my gem"
s.description = "More detailed description" # Maybe a tiny bit more detailed?
s.authors = ["Me"]
s.email = '[email protected]' # Please don't email me, as I rarely look at my email
s.files = ["lib/myGem.ruby"] # Change to .rb
s.homepage =
'https://rubygems.org/gems/foobar'
end
# Add s.license
=begin
foo
bar
=end
Thanks in advance.
I'm making a Ruby gem, and I want to put comments in the file. Would this be allowed, or would it mess up the gem?
Like most programming languages, Ruby has comments. In fact, Ruby has two kinds of comments:
#
and end with the end of the line:
#!/usr/bin/env ruby
# Shebang lines are just interpreted as comments, which is clever.
some_code # This is a comment.
# So is this.
foo.bar.
# Comments are allowed in lots of places.
baz(
# And here.
23, # And here.
42,
# And here.
:foo
)
# Even here.
.quux
=begin
at the beginning of a line and end with the token =end
at the beginning of a line:
some_code
=begin This is a comment.
This is still the same comment.
So is this.
This is not the end of the comment: =end
But this is:
=end
If you want to know all the gory details, I recommend reading:
language/comment_spec.rb
of The Ruby Spec Suite aka ruby/spec