jaycode
jaycode

Reputation: 2958

What does ; mean in Ruby?

I am trying to learn how to write plugins in Rails by learning other people's plugins, 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?

Upvotes: 2

Views: 250

Answers (2)

Matthew Rankin
Matthew Rankin

Reputation: 461217

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

Upvotes: 4

ase
ase

Reputation: 13491

It's a way of putting multiple expressions on one line.

class UnableToLoadAdapter < Exception
end

is exactly the same as

class UnableToLoadAdapter < Exception; end

Upvotes: 6

Related Questions