A modifier that allows exposing attributes for objects to directly view/modify.
class myClass
attr_accessor : name
def initialize(name)
@name = name
end
end
This will expose the methods:
name
: returns the value of namename=
: modify the value of name
myObject = myclass.new("daniel")
myObject.name # will return 'daniel'
myObject.name="david" # will modify value