A TOUR OF RUBY 2011 ACM Class, Dong Xie
What is Ruby? Dynamic programming language Complex but expressive grammar A core class library with rich and powerful APIs Draws inspiration from Lisp, Smalltalk and Perl Easy for C and Java programmers to learn Ruby is designed to make programmers happy. ——By Yukihiro Matsumoto
Optional parentheses Parallel assignment Punctuation Suffixes and Prefixes Simplified Expressions
Everything is an Object Completely object-oriented language Seeing Everything as an Object even simple numeric literals and the values true, false and nil Only single inheritance, the Mixin(Module)
Everything has a value NO difference between expressions and statements Everything has a value, even if that value is nil Even control structures have their own value such as if, while, etc.
Classes are Open Dynamic Programming Language Not only dynamic-typed (like python, PHP, etc.) Allows its users to freely alter its parts Add, Remove, Redefine
Singleton methods Per-object methods Only available on the Object you defined it on
Iterators and Blocks “A truly expressive feature” Iterators —— loops Blocks —— associate with a method invocation
Procs and Lambdas Class Proc, Kernel.Lambda Functions that can be manipulated as objects Block as a single parameter Instances of class Proc as parameters
And more… Symbols are not lightweight strings “Variable” constants Fake keyword parameters The universal truth Missing methods Metaprogramming capability Packages —— RubyGems ……
To learn more… Official Site: Ruby in a Nutshell The Ruby Programming Language The Book of Ruby Programming Ruby Ruby Cookbook
Any questions are welcomed… Q&A
Contact: Thanks for Listening