J
Jeff Thorne
------=_NextPart_000_000F_01C654E5.5149E8C0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I am new to ruby from java and had a question on blocks.
Can a block be applied to a writeable attribute or setter? I keep getting
errors so I
am assuming no but I wanted to double check in case my syntax is incorrect.
Thanks for the help,
Jeff
class Test
def initialize(one, two)
@one = one
@two = two
end
def one=(one)
@one = one;
Yield;
end
attr_reader ne, :two
attr_writer :two
end
test = Test.new("Hello", 2);
test.one = 3 { puts "Test Block" }
------=_NextPart_000_000F_01C654E5.5149E8C0--
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I am new to ruby from java and had a question on blocks.
Can a block be applied to a writeable attribute or setter? I keep getting
errors so I
am assuming no but I wanted to double check in case my syntax is incorrect.
Thanks for the help,
Jeff
class Test
def initialize(one, two)
@one = one
@two = two
end
def one=(one)
@one = one;
Yield;
end
attr_reader ne, :two
attr_writer :two
end
test = Test.new("Hello", 2);
test.one = 3 { puts "Test Block" }
------=_NextPart_000_000F_01C654E5.5149E8C0--