Guest User

Untitled

a guest
Aug 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. # Behind the scenes, Ruby turns this into a method call.
  2. # Ruby adds some keywords to create them.
  3. class User
  4. attr_reader :name, :age
  5. attr_write :name
  6. end
  7. # => nil
  8.  
  9. class User
  10. attr_accessor :name
  11. end
  12. # => nil
  13.  
  14. User.public_instance_methods(false).grep(/name/)
  15. # => [:name, :name=]
Add Comment
Please, Sign In to add comment