I'm trying to use Ruby modules (mixins).
I have test.rb:
#!/usr/bin/env ruby
require_relative 'lib/mymodule'
class MyApp
include MyModule
self.hallo
end
and lib/mymodule.rb:
module MyModule
def hallo
puts "hallo"
end
end
Quite simple setup. But it does not work :( :
ruby test.rb
test.rb:8:in `<class:MyApp>': undefined method `hallo' for MyApp:Class (NoMethodError)
from test.rb:6:in `<main>'
Where is my error?