On 20 April 2012 20:40, Jedrin <[email protected]> wrote: > > > Somewhere in all of the ruby code that gets included into this app I > am working on, there is something that defined String so that the > following is a valid statement > > puts "contact us at " + "[email protected]"[] + " and say hello" > > > The app that runs, is able to include that stuff and Ruby doesn't > complain. When I try to write a test module and > include some of the code, ruby complains beuse my load paths or some > part of the configuration is different. I am not really sure. > > If I monkey patch string like below, it seems to stop the errors, but > I am not sure if it could be causing other problems. > > class String > def [](x=nil,b=nil) > self > end > end > > I am on windows, but I am using cygwin. I did something like what's > below, but did not find where [] might be defined: > > find . -name "*.rb" -exec grep -A 15 "class String" {} \; -print > / > cygdrive/c/tmp/str-patch.txt > > > Any other ideas to figure this out ? How can I tell inside irb or > something what the code is for "[email protected]"[] > or where it is defined ?
You could use ruby-debug (assuming that is available on Windows, I don't know) and step into "string"[] to see where it is defined. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

