Return to Snippet

Revision: 24768
at March 10, 2010 18:43 by inkdeep


Initial Code
class Kung
  mstr = %-
        def foo
          puts 'Hello World from Kung.foo'
          puts caller(0).inspect
        end
      -
  module_eval mstr
end
    
Kung.new.foo



class Monkey
  line, mstr = __LINE__, %-
        def see
          puts 'Hello World from Monkey.see'
          puts caller(0)
        end
      -
  module_eval mstr, __FILE__, line
end
    
Monkey.new.see


class Monkey
  module_eval(<<-EOS, __FILE__, __LINE__)
        def see
          puts 'Hello World from Monkey.see'
          puts  caller(0)
        end
      EOS
end
    
Monkey.new.see

Initial URL


Initial Description


Initial Title
Ruby caller experiments

Initial Tags
ruby

Initial Language
Ruby