アクセサメソッドを簡単定義するには,attr_accessor メソッドを使う.
class foo
@bar = 0
attr_accessor :bar
def
f = foo.new
f.bar = 10
p f.bar #=> 10
comments powered by Disqus
アクセサメソッドを簡単定義するには,attr_accessor メソッドを使う.
class foo
@bar = 0
attr_accessor :bar
def
f = foo.new
f.bar = 10
p f.bar #=> 10
comments powered by Disqus