Skip to content

Instantly share code, notes, and snippets.

@jwreagor
Created June 4, 2009 13:45
Show Gist options
  • Save jwreagor/123620 to your computer and use it in GitHub Desktop.
Save jwreagor/123620 to your computer and use it in GitHub Desktop.
class Class
def attr_reader(name)
meth = Rubinius::AccessVariable.get_ivar name
@method_table[name] = meth
return nil
end
def attr_writer(name)
meth = Rubinius::AccessVariable.set_ivar name
@method_table["#{name}=".to_sym] = meth
return nil
end
def attr_accessor(name)
attr_reader(name)
attr_writer(name)
return true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment