B
Brian Schroeder
Hello,
it's me again with another question. I want to include a module only after
having instantiated a class. Something like this
File: german.rb
Module Index
Title = 'Meine Seite'
end
File: english.rb
Module Index
Title = 'My Page'
end
file index.rb:
class Index < Website
def initialize
super
include(Index)
end
end
where Website requires either german.rb or english.rb.
But I can't call include as a function. Ruby complains that it is a
private function of class.
../index.rb:10:in `initialize': private method `include' called for Index:Class (NoMethodError)
from ./index.rb:27:in `new'
from ./index.rb:27
Is this scheme possible, am I totally on the wrong track or just missing
something obvious?
Regards,
Brian
it's me again with another question. I want to include a module only after
having instantiated a class. Something like this
File: german.rb
Module Index
Title = 'Meine Seite'
end
File: english.rb
Module Index
Title = 'My Page'
end
file index.rb:
class Index < Website
def initialize
super
include(Index)
end
end
where Website requires either german.rb or english.rb.
But I can't call include as a function. Ruby complains that it is a
private function of class.
../index.rb:10:in `initialize': private method `include' called for Index:Class (NoMethodError)
from ./index.rb:27:in `new'
from ./index.rb:27
Is this scheme possible, am I totally on the wrong track or just missing
something obvious?
Regards,
Brian