What does ; mean in Ruby?
I am trying to learn how to write plugins in Rails by learning other people's p开发者_Python百科lugins, turns out it is way harder than I thought.
I found this:
module Facebooker
class AdapterBase
class UnableToLoadAdapter < Exception; end
What does the fourth line: class UnableToLoadAdapter < Exception; end
mean?
It's a way of putting multiple expressions on one line.
class UnableToLoadAdapter < Exception
end
is exactly the same as
class UnableToLoadAdapter < Exception; end
Ruby supports ending lines of code with semicolons (;) and allows you to put multiple lines of code onto a single line (for example, x = 10; x += 1; puts x).
Beginning Ruby: From Novice to Professional, 2nd ed. by Peter Cooper
精彩评论