Shell.rb and class << Shell


#1

I’m confuzzled.

In lib/shell.rb I read…

============================================================
class Shell
@RCS_ID=’-$Id: shell.rb,v 1.8 2001/03/19 09:01:11 keiju Exp keiju $-’

include Error
extend Exception2MessageMapper

@cascade = true

debug: true -> normal debug

debug: 1 -> eval definition debug

debug: 2 -> detail inspect debug

@debug = false
@verbose = true

class << Shell

Question 1.
Why does he use this “class << Shell” trick? What does that do?

Question 2.
What does Exception2MessageMapper do? Yes, I have read the comments
three times, and I still don’t know what it does or why.

John C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : removed_email_address@domain.invalid
New Zealand

Carter’s Clarification of Murphy’s Law.

“Things only ever go right so that they may go more spectacularly wrong
later.”

From this principle, all of life and physics may be deduced.


#2

On 4/12/06, John C. removed_email_address@domain.invalid wrote:

Question 1.
Why does he use this “class << Shell” trick? What does that do?

This is equivalent to:

class Shell
class << self
end
end

The latter you should be familiar with from numerous postings on the
list.

Question 2.
What does Exception2MessageMapper do? Yes, I have read the comments
three times, and I still don’t know what it does or why.

You’ll need to look at lib/e2mm.rb for details, but it seems to create
a framework for exceptions with default error messages.

-austin