From: "Marvin Gülker" Date: 2010-07-26T03:25:55+09:00 Subject: Re: * operator, Float Иван Сташко wrote: > Where is the * operator defined for Float? > > ree-1.8.7-2010.02 > 3.0.methods.grep "*" > => ["*"] > ree-1.8.7-2010.02 > 3.0.class > => Float > ree-1.8.7-2010.02 > Float.methods.grep "*" > => [] > ree-1.8.7-2010.02 > Float.superclass > => Numeric > ree-1.8.7-2010.02 > Numeric.methods.grep "*" > => [] > ree-1.8.7-2010.02 > Numeric.superclass > => Object > ree-1.8.7-2010.02 > Object.methods.grep "*" > => [] > ree-1.8.7-2010.02 > Object.superclass > => nil > > I'm guessing there's a mixin somewhere or this has to do with > eigenclasses or perhaps a C-module has been mixed-in between Numeric and > Float. Where do I look at this code? The way you're trying to find the #* method is wrong. You try to find Class#*, not Float#*. Try it this way: irb(main):004:0> Float.public_instance_methods.map(&:to_s).grep("*") => ["*"] irb(main):005:0> Numeric.public_instance_methods.map(&:to_s).grep("*") => [] irb(main):006:0> If Float#* wasn't defined in C code, you could use Method#source_location to find out where it is defined (at least in Ruby 1.9): irb(main):006:0> 3.0.method(:*).source_location => nil irb(main):007:0> require "pathname" => true irb(main):008:0> Pathname.new("x").method(:to_s).source_location => ["/opt/rubies/ruby-1.9.1-p429/lib/ruby/1.9.1/pathname.rb", 248] irb(main):009:0> If #source_location gives you nil, you're dealing with a C method. Marvin -- Posted via http://www.ruby-forum.com/.