From 02044c1eab7d7d8a670c1f63b004e91df83d22c4 Mon Sep 17 00:00:00 2001 From: David Underwood Date: Sun, 1 Dec 2013 21:42:51 -0500 Subject: [PATCH] Ruby: Adds attr_accessor, attr_reader, and attr_writer to class docs --- ruby.html.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ruby.html.markdown b/ruby.html.markdown index bf4cb229..a4c74a4f 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -323,6 +323,13 @@ class Human @name end + # The above functionality can be encapsulated using the attr_accessor method as follows + attr_accessor :name + + # Getter/setter methods can also be created individually like this + attr_reader :name + attr_writer :name + # A class method uses self to distinguish from instance methods. # It can only be called on the class, not an instance. def self.say(msg)