Sto provando a utilizzare i moduli Ruby (mixins).Ruby: modulo, richiede e include
devo test.rb:
#!/usr/bin/env ruby
require_relative 'lib/mymodule'
class MyApp
include MyModule
self.hallo
end
e lib/mymodule.rb:
module MyModule
def hallo
puts "hallo"
end
end
Abbastanza semplice configurazione. Ma non funziona :(:?.
ruby test.rb
test.rb:8:in `<class:MyApp>': undefined method `hallo' for MyApp:Class (NoMethodError)
from test.rb:6:in `<main>'
Dove è il mio errore