Introduction to Ruby      Andrew Liu
Ruby is…• Designed by Yukihiro Matsumoto (松本行弘)  – "I wanted a scripting language that was more    powerful than Perl, and...
Philosophy• Often people, especially computer engineers, focus  on the machines. They think, "By doing this, the  machine ...
Naming Convention• CamelCase  – Class names, module names• ALLCAPITAL  – Constants• words_with_underscore  – Method names,...
Everything is an object!
Strings
String Methods
Array
What if I want to reverse the array?                        http://ruby-doc.org/core/
Range
Hash
Block
How does it work?
More About Class
More About Class
Class• Variable  – @@ prefix: Shared by all class instances  – @ prefix: Contains instances information  – No prefix: norm...
Creating Instance
Flow Control
Cases
While
For
Resources• Programming Ruby (Bible)  – http://www.ruby-    doc.org/docs/ProgrammingRuby/• Ruby API Document  – http://ruby...
Introduction to ruby
Introduction to ruby
Introduction to ruby
Upcoming SlideShare
Loading in …5
×

Introduction to ruby

603
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
603
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to ruby

  1. 1. Introduction to Ruby Andrew Liu
  2. 2. Ruby is…• Designed by Yukihiro Matsumoto (松本行弘) – "I wanted a scripting language that was more powerful than Perl, and more object- oriented than Python. Thats why I decided to design my own language“• An object-oriented scripting language• Easy to learn!
  3. 3. Philosophy• Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something."• They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.
  4. 4. Naming Convention• CamelCase – Class names, module names• ALLCAPITAL – Constants• words_with_underscore – Method names, variable names• $ prefix – Global variables
  5. 5. Everything is an object!
  6. 6. Strings
  7. 7. String Methods
  8. 8. Array
  9. 9. What if I want to reverse the array? http://ruby-doc.org/core/
  10. 10. Range
  11. 11. Hash
  12. 12. Block
  13. 13. How does it work?
  14. 14. More About Class
  15. 15. More About Class
  16. 16. Class• Variable – @@ prefix: Shared by all class instances – @ prefix: Contains instances information – No prefix: normal variables• Methods – self. Prefix: Class methods, as known as static method – No prefix: Instance methods, must be called with a instance
  17. 17. Creating Instance
  18. 18. Flow Control
  19. 19. Cases
  20. 20. While
  21. 21. For
  22. 22. Resources• Programming Ruby (Bible) – http://www.ruby- doc.org/docs/ProgrammingRuby/• Ruby API Document – http://ruby-doc.org/core/• TryRuby – http://tryruby.org/• Ruby Warrior – https://github.com/ryanb/ruby-warrior
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×