>Why does this snippet fail?
>
> class String
> def String.comment (str)
> str =~ /^(#| *$)/
> end
> end
Why are you making comment a class method?
It seems to work fine as an instance method:
class String
def comment
self =~ /^(#| *$)/
end
end
File.open("xxx") { |conf|
conf.readlines.each { |line|
next if line.comment
Regards,
/\ndy
--
Andrew Hunt, The Pragmatic Programmers, LLC.
Innovative Object-Oriented Software Development
web: http://www.pragmaticprogrammer.com email: andy / pragmaticprogrammer.com
--
Our New Book: "The Pragmatic Programmer" Published by Addison-Wesley Oct 1999
(see www.pragmaticprogrammer.com/ppbook)
--