Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Behind the scenes, Ruby turns this into a method call.
- # Ruby adds some keywords to create them.
- class User
- attr_reader :name, :age
- attr_write :name
- end
- # => nil
- class User
- attr_accessor :name
- end
- # => nil
- User.public_instance_methods(false).grep(/name/)
- # => [:name, :name=]
Add Comment
Please, Sign In to add comment