[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01856] Another question from a newbie

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-15 19:15:50 UTC
List: ruby-talk #1856
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 :-)


In This Thread

Prev Next