summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
authorCamilo Garrido <hiro.hope@gmail.com>2013-08-11 12:47:21 -0400
committerCamilo Garrido <hiro.hope@gmail.com>2013-08-11 12:47:21 -0400
commite6bae9cbd39dbed3b5db2f1673a954132ce889e2 (patch)
treecd2909593568b94616329abd43a0016be05473ff /ruby.html.markdown
parent80ea89b58a470f9b1a4ce7710f4de6ac69dee5ee (diff)
parent28b26b85ff3a94501adc0550c484c90d3e76fb90 (diff)
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r--ruby.html.markdown60
1 files changed, 30 insertions, 30 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 99817982..861a94ad 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -275,36 +275,36 @@ surround { puts 'hello world' }
# Define a class with the class keyword
class Human
- # A class variable. It is shared by all instances of this class.
- @@species = "H. sapiens"
-
- # Basic initializer
- def initialize(name, age=0)
- # Assign the argument to the "name" instance variable for the instance
- @name = name
- # If no age given, we will fall back to the default in the arguments list.
- @age = age
- end
-
- # Basic setter method
- def name=(name)
- @name = name
- end
-
- # Basic getter method
- def name
- @name
- end
-
- # 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)
- puts "#{msg}"
- end
-
- def species
- @@species
- end
+ # A class variable. It is shared by all instances of this class.
+ @@species = "H. sapiens"
+
+ # Basic initializer
+ def initialize(name, age=0)
+ # Assign the argument to the "name" instance variable for the instance
+ @name = name
+ # If no age given, we will fall back to the default in the arguments list.
+ @age = age
+ end
+
+ # Basic setter method
+ def name=(name)
+ @name = name
+ end
+
+ # Basic getter method
+ def name
+ @name
+ end
+
+ # 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)
+ puts "#{msg}"
+ end
+
+ def species
+ @@species
+ end
end