class Test #get method def masa @aaa end def masa=(val) #set method @aaa = val end end # is the same as above, 'set' and 'get' combined class Test2 attr_accessor :masa end test = Test.new test.masa = 123 p test.masa test2 = Test2.new test2.masa = 223 p test2.masa