M
Mark Cox
Hi,
Is there a way to give a block associated with a method call the same scope
as if it were executing inside the method.
ie.
class Foo
ACONST = 1
def input_flags
@FLAG_SEL = INPUT
yield
end
def output_flags
@FLAG_SEL = OUTPUT
yield
end
def set(flgs)
set_flags(@FLAG_SEL, flgs)
end
end
f = Foo.new
f.input_flags {
set ACONST
}
f.output_flags {
set ACONST
}
Thanks in advance.
Mark Cox
Is there a way to give a block associated with a method call the same scope
as if it were executing inside the method.
ie.
class Foo
ACONST = 1
def input_flags
@FLAG_SEL = INPUT
yield
end
def output_flags
@FLAG_SEL = OUTPUT
yield
end
def set(flgs)
set_flags(@FLAG_SEL, flgs)
end
end
f = Foo.new
f.input_flags {
set ACONST
}
f.output_flags {
set ACONST
}
Thanks in advance.
Mark Cox