Advanced Ruby Programming

X

Xiangrong Fang

Hi,

I have been using ruby for awhile, but I still know very little about it
:(.

Today I read the uri.rb file because I need to port a piece of Java code
to ruby. I found that I cannot understand uri.rb at all!

1. what is the use of nested modules? i.e., why?

2. What is the meaning of the following code? especially the "(?:" and
"(?# 1:"?

(#{PATTERN::SCHEME}): (?# 1: scheme)
(?:
(#{PATTERN::OPAQUE_PART}) (?# 2: opaque)

Could any expert here point me to the right direction? Where can I find
a book or online resource that explain these advanced topics?

Thanks a lot.

Sincerely,
Shannon
 
X

Xiangrong Fang

Oh, that's part of a regexp? Thanks a lot :)

Shannon

* Xiangrong Fang ([email protected]) [28 Aug 2003 22:49]:

[...]
1. what is the use of nested modules? i.e., why?

Separation of code?
2. What is the meaning of the following code? especially
the "(?:" and "(?# 1:"?
(#{PATTERN::SCHEME}): (?# 1: scheme)
(?:
(#{PATTERN::OPAQUE_PART}) (?# 2: opaque)

(?:...) and (?#...) are documented in the pickaxe.

Respectively they are 'cluster' (group without capturing),
and 'embedded comment'.


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top