diff options
author | Adam Bard <github@adambard.com> | 2013-08-08 14:29:36 -0700 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2013-08-08 14:29:36 -0700 |
commit | 900f5448eb7d7578d36c559b0c859867478c84ac (patch) | |
tree | dee6c95562ddd7a1faca347478aa5ff797eba253 | |
parent | f97d85c5ab8660c41560c375eff44c6052d61d2f (diff) | |
parent | 97a99b0ad55894631bcca03e086a2f23033c7c4b (diff) |
Merge pull request #175 from m5o/patch-1
fix indentation by 2 spaces
-rw-r--r-- | ruby.html.markdown | 60 |
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 |