What is wrong with this code? Running on ruby 1.8.6
#==================================
module MFoo
def printme
puts ‘MFooPrint’
end
def initialize
puts ‘init’
end
end
class Foo
include MFoo
def printme
puts ‘FooPrint’
end
end
class Foo2 < Foo
def printme
super.printme
end
end
s = Foo2.new;
s.printme
#==================================
This code outputs:
C:/Users/Volodymyr/Documents/NetBeansProjects/RubyApplication3/lib/
main.rb:17:in printme': undefined method
printme’ for nil:NilClass
(NoMethodError)
init
FooPrint
from C:/Users/Volodymyr/Documents/NetBeansProjects/
RubyApplication3/lib/main.rb:22