From: Ed Sinjiashvili Date: 2002-04-25T16:44:57+09:00 Subject: Re: appending methods to class inside module Ian Macdonald writes: > Hi, > For some reason, the Dog module is preventing the bark method from > being appended to the String class. That's right, you define String class under Dog namespace - its fully qualified name is Dog::String. > > My question is: how can I get String#bark to be defined, so that I can > then call the bark method on foo? Just define it at a toplevel. whailer% cat dog.rb module Dog class String def bark p self.class puts "Woof!" end end end class String def bark p self.class puts "Woof woof!" end end Dog::String.new.bark "good doggy".bark whailer% whailer% ruby dog.rb Dog::String Woof! String Woof woof! whailer% -- Ed