class Decoder
FOO = %r{foo}
BAR = %r{bar}
FOOBAR = %r{#{FOO.regex}|#{BAR.regex}}
…
I’m having to do
FOO = ‘foo’
RE_FOO = %r{FOO}
So I can use the regex bits in other regexes, and as regexes themselves.
I’d love any suggestions on a nicer way to do this!
Thanks,
Sam
[23:27] drbrain@huphu:~/ruby/borges$ ri Regex.source
---------------------------------------------------------- Regexp#source
rxp.source → aString
···
Sam Roberts (sroberts@uniserve.com) wrote:
class Decoder
FOO = %r{foo}
BAR = %r{bar}
FOOBAR = %r{#{FOO.regex}|#{BAR.regex}}
…
I’m having to do
FOO = ‘foo’
RE_FOO = %r{FOO}
So I can use the regex bits in other regexes, and as regexes themselves.
I’d love any suggestions on a nicer way to do this!
Returns the original string of the pattern.
/ab+c/ix.source #=> "ab+c"
–
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
Quoteing drbrain@segment7.net, on Mon, Jan 27, 2003 at 04:28:31PM +0900:
···
Sam Roberts (sroberts@uniserve.com) wrote:
[23:27] drbrain@huphu:~/ruby/borges$ ri Regex.source
Thats funny! I did a ri Regex and looked at the methods that looked
promissing, but “source” means to do a run-time evaluation, in my
mind, I never even read the docs for this method…
Thanks,
Sam
I have occasionally thought it would be nice to be able to see the doc
for all methods for a given module/class, to avoid this type of random
“that can’t be it” hunting
···
Sam Roberts (sroberts@uniserve.com) wrote:
Quoteing drbrain@segment7.net, on Mon, Jan 27, 2003 at 04:28:31PM +0900:
Sam Roberts (sroberts@uniserve.com) wrote:
[23:27] drbrain@huphu:~/ruby/borges$ ri Regex.source
Thats funny! I did a ri Regex and looked at the methods that looked
promissing, but “source” means to do a run-time evaluation, in my
mind, I never even read the docs for this method…
–
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
You’ll get it soonish. Core classes are being RDoc’ed, so method
browsing is a viable option.
Gavin
···
On Tuesday, January 28, 2003, 4:39:02 AM, Eric wrote:
Sam Roberts (sroberts@uniserve.com) wrote:
Quoteing drbrain@segment7.net, on Mon, Jan 27, 2003 at 04:28:31PM +0900:
Sam Roberts (sroberts@uniserve.com) wrote:
[23:27] drbrain@huphu:~/ruby/borges$ ri Regex.source
Thats funny! I did a ri Regex and looked at the methods that looked
promissing, but “source” means to do a run-time evaluation, in my
mind, I never even read the docs for this method…
I have occasionally thought it would be nice to be able to see the doc
for all methods for a given module/class, to avoid this type of random
“that can’t be it” hunting