F
Florian Weber
hi!
how can i make that the example below returns 'Hello, my name is test'?
module Barable
def self.append_features(base)
base.extend(ClassMethods)
super
end
module ClassMethods
def bar(bar)
@bar = bar
end
end
end
class Foo
include Barable
bar "test"
def hi
puts "Hello, my bar is #{@bar}"
end
end
Foo.new.hi
thanks!
ciao!
florian
how can i make that the example below returns 'Hello, my name is test'?
module Barable
def self.append_features(base)
base.extend(ClassMethods)
super
end
module ClassMethods
def bar(bar)
@bar = bar
end
end
end
class Foo
include Barable
bar "test"
def hi
puts "Hello, my bar is #{@bar}"
end
end
Foo.new.hi
thanks!
ciao!
florian