diff options
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r-- | ruby.html.markdown | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown index 2de134ae..2c9a4cb9 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -1,7 +1,9 @@ --- language: ruby +filename: learnruby.rb contributors: - ["David Underwood", "http://theflyingdeveloper.com"] + - ["Joel Walden", "http://joelwalden.net"] --- ```ruby @@ -90,8 +92,9 @@ path_to_project_root = '/good/name/' path = '/bad/name/' # Symbols (are objects) -# Symbols are immutable, reusable constants represented internally by an integer value -# They're often used instead of strings to efficiently convey specific, meaningful values +# Symbols are immutable, reusable constants represented internally by an +# integer value. They're often used instead of strings to efficiently convey +# specific, meaningful values :pending.class #=> Symbol @@ -154,7 +157,7 @@ new_hash = { defcon: 3, action: true} new_hash.keys #=> [:defcon, :action] # Tip: Both Arrays and Hashes are Enumerable -# This means they share a lot of useful methods such as each, map, count, and more +# They share a lot of useful methods such as each, map, count, and more # Control structures @@ -277,8 +280,8 @@ class Human @name end - # A class method; uses self to distinguish from instance methods. (Can only be called on class, not an instance). - + # 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 @@ -303,4 +306,4 @@ dwight.name #=> "Dwight K. Schrute" # Call the class method Human.say("Hi") #=> "Hi" -```
\ No newline at end of file +``` |