Ruby's attr_accessor is a great example of this. When you add the line
attr_accessor :age
a bit of nifty metaprogramming kicks in and generates the following getter/setter methods in your class def age= value
@age = value
end
def age
@age
end