Ruby

Ruby ‡ Overview: ± Object-oriented scripting language ± Developed by Yukihiro Matsumoto .

Math. even the most primitive things: strings.abs vs. numbers and even true and false ‡ Methods are always called on an object there are no class methods ‡ Example: -233.abs(-233) in Java .Ruby ‡ Features: ± Pure object-oriented language: ‡ Every value in Ruby is an object.

Interpreted ‡ A program can also modify its own definitions while it s running. ‡ Variables in Ruby are dynamically typed .Ruby ‡ Features: ± Dynamic: ‡ Everything in a program are built by the code when it run .

.Ruby ‡ Features: ± Singleton Classes: ‡ Every object has two classes : a regular class and a singleton class ‡ Singleton class is a nameless class whose only instance is that object ‡ Methods can be added to a singleton class. which can then be called on the lone object belonging to them.

size => hello world .size => 0 ‡ Add methods: def foorbar.class => Array Foobar.new foobar.size hello world end foobar.Ruby ‡ Features: ± Singleton Classes: ‡ Example: foobar = Array.

.Ruby ‡ Features: ± Flexibility: ‡ Methods can be added to existing classes without subclassing ‡ Operators can be overloaded ‡ The behavior of the standard library can be redefined at runtime.

Ruby ‡ Features: ± Variables and Scope: ‡ You do not need to declare variables or variable scope in Ruby. ‡ Example : ± ± ± ± $x : global variable x : local variable @x : instance variable @@x : class variable . ‡ The name of the variable automatically determines its scope.

which is called at anytime just like a method. .Ruby ‡ Features: ± Blocks ‡ One of Ruby s most unique. or even copied. ‡ A block object can be stored in a variable. it is packaged into an object. ‡ The code in the block is not evaluated right away. passed along to other methods.

.Ruby ‡ Features ± Advanced Features ‡ Exceptions for error-handling ‡ OS-independent threading. which allows you to write multi-threading applications even on operating systems such as DOS.

Ruby and Rhodes ‡ Rhodes development architecture: ± Model : ORM (object relational manager). Rhom ± User Interface : HTML. CSS ± Logic of views: ERB (embedded ruby) ± Controller: Ruby .

Sign up to vote on this title
UsefulNot useful