From: Robert Klemme Date: 2010-05-04T23:50:56+09:00 Subject: Re: Scope 2010/5/4 Eduardo Mucelli R. Oliveira : > I have a script with those two following classes: > > class String >   def to_b >      ["true"].include?(self.downcase) >   end > end Why are you doing it so complicated? Why not just this: def to_b "true" == downcase end > class HereIWantUseToB >   "string".to_b > end You are using #to_b on a string constant that is not attached anywhere (e.g. as class or instance variable). What exactly are you trying to do? > Ok,  that works fine, the to_b method can be "seen" by > HereIWantToUseToB class. But I wanted to those two classes inside > another class, or module, like this: > > class Everything >   # The two classes described above are here > end > > module Everything >   # The two classes described above are here > end > > Anyway, for both cases I have the message "NoMethodError: undefined > method `to_b’ for string." What is the scope point in here, what is > the best way solve that so ? Please show the complete code that leads to the error. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/