# Nubie question

**URL:** <https://www.ruby-forum.com/t/nubie-question/110705>\
**Category:** Ruby\
**Created:** [July 30, 2007, 12:05am UTC](https://www.ruby-forum.com/t/nubie-question/110705 "2007-07-30T00:05:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mac\_Pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@Mac\_Pat](https://www.ruby-forum.com/u/Mac_Pat)\
**Post date:** [July 30, 2007, 12:05am UTC](https://www.ruby-forum.com/t/nubie-question/110705/1 "2007-07-30T00:05:26Z")

</div>

I am trying to learn Ruby and I have read the picax book at least twice  
and  
seems to understand most of what is said in the book. Now I am reading  
through some of the code written that I down loaded. I saw some code  
that I  
wanted someone to explain to me.

module HL7 # :nodoc:  
VERSION = “0.1.%s” % “$Rev: 23 $”.gsub(/$Rev:\s+/, ‘’).gsub(/\s\*$$/,  
‘’)  
end

# Encapsulate HL7 specific exceptions

class HL7::Exception \< StandardError  
end

# Parsing failed

class HL7::ParseError \< HL7::Exception  
end

Explain to me how to use the “::” operator. It seems the author is  
defining  
a Class called HL7::Exception? The syntax for class definition is Class  
Name.

Thanksl

---

<div class="post-metadata">

**Author:** ![Mac\_Pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@Mac\_Pat](https://www.ruby-forum.com/u/Mac_Pat)\
**Post date:** [July 30, 2007, 1:40am UTC](https://www.ruby-forum.com/t/nubie-question/110705/2 "2007-07-30T01:40:33Z")

</div>

Hi,

Am Montag, 30. Jul 2007, 07:04:57 +0900 schrieb Mac Pat:

> module HL7 # :nodoc:  
> VERSION = “0.1.%s” % “$Rev: 23 $”.gsub(/$Rev:\s+/, ‘’).gsub(/\s\*$$/, ‘’)  
> end

I think smarter would be one of

V = “0.1.” + “$Rev: 23 $”[/$Rev:\s\*(\d+)\s\*$/, 1]  
V = “0.1.%d” % “$Rev: 23 $”[/\d+/]  
V = [0,1,"$Rev: 23 $"[/\d+/]].join “.”

To get it readable to some slight extent one should split it  
up into at least two lines.

tiny = “$Rev: 23 $”[/\d+/]  
…

> # Encapsulate HL7 specific exceptions
> 
> class HL7::Exception \< StandardError  
> end

module HL7 ; class Exception \< ::StandardError ; end ; end

Bertram

---

<div class="post-metadata">

**Author:** ![Mac\_Pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@Mac\_Pat](https://www.ruby-forum.com/u/Mac_Pat)\
**Post date:** [July 30, 2007, 1:09am UTC](https://www.ruby-forum.com/t/nubie-question/110705/3 "2007-07-30T01:09:30Z")

</div>

> explain to me.
> 
> # Parsing failed
> 
> Thanksl

Check out the Pickaxe chapter on modules.

HTH,

Felix
