M
MichaelEconomy
ok, i've got some module and it has some instance variables i want to
be set by the classes extending the module, and aparently i'm not doing
this correctly:
module A
def test
raise 'ARG' if !@blah
@blah
end
end
class B
include A
extend A
@blah = 'YES!'
end
irb(main):025:0> b = B.new
=> #<B:0x136376c>
irb(main):026:0> b.test
RuntimeError: ARG
from (irb):9:in `test'
from (irb):26
can anyone tell me what the syntax should be? how do i set @blah in the
B class so that its available to the test method
be set by the classes extending the module, and aparently i'm not doing
this correctly:
module A
def test
raise 'ARG' if !@blah
@blah
end
end
class B
include A
extend A
@blah = 'YES!'
end
irb(main):025:0> b = B.new
=> #<B:0x136376c>
irb(main):026:0> b.test
RuntimeError: ARG
from (irb):9:in `test'
from (irb):26
can anyone tell me what the syntax should be? how do i set @blah in the
B class so that its available to the test method