Why does this snippet fail?
class String
def String.comment (str)
str =~ /^(#| *$)/
end
end
File.open(ENV["ORACONF"]) { |conf|
conf.readlines.each { |line|
next if line.comment
[ ... ]
However, if the last line is converted to:
next if String.comment(line)
it works. I tried using ..... ~ /pattern/ ......... and also tried ........ self =~ /pattern/ ....... (both without a "(str)" in the definition) - but nothing works but what you see above. The "String.function(arg)" just rankles this OO-wannabe-purist :-)