HEMANT SONKER’S BLOG

September 21, 2007

More stuffs on Ruby

Filed under: ruby — Hemant Sonker @ 4:16 pm

Variables and identifers normally start with an alphabetic letter or a special modifier.

  • Local variables (&pseudo-variables such as self and nil) begin with a lowrcase letter.
  • Global variables begin with dollar sign($)
  • Instance variables with an object begin with an at sign(@)
  • Class variables within a class begin with two at signs @@.
  • Constant begin with capital letters.

For Example

  1. local variables: alpha_ident,gama
  2. pseudo-variables:self,nil
  3. Constants:LENGTH,Length
  4. Instance variables:@sum,@not_const
  5. Class variable:@@my_var
  6. Global variable:$beta,$pi

We will see some codes in ruby in the next post

September 20, 2007

Ruby Basics…

Filed under: ruby — Hemant Sonker @ 11:06 pm

Hey guy’s have you word before. Hope so you have heard this name earlier.But those who have not heard of this, i would like to give a brief thing about it.Ruby on Rails is basically a open source language.Yukhiro Matsumoto,known as Matz created Ruby in 1993.
So lets first understand that what is Ruby?

Ruby is a cross-platform interpreted language which has many features in common with other scripting languages like Perl,Python,LISP etc.Ruby is hightly dynamic and extensible.

A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

In Ruby, everything is an object. Every bit of information and code can be given their own properties and actions. Object-oriented programming calls properties by the name instance variables and actions are known as methods. Ruby’s pure object-oriented approach is most commonly demonstrated by a bit of code which applies an action to a number.

Ruby follows the influence of the Smalltalk language by giving methods and instance variables to all of its types. This eases one’s use of Ruby, since rules applying to objects apply to all of Ruby.

Ruby is seen as a flexible language, since it allows its users to freely alter its parts. Essential parts of Ruby can be removed or redefined, at will. Existing parts can be added upon. Ruby tries not to restrict the coder.

Ruby has certain features :

  • Ruby has exception handling features, like Java or Python, to make it easy to handle errors.
  • Ruby features OS independent threading. Thus, for all platforms on which Ruby runs, you also have multithreading, regardless of if the OS supports it or not, even on MS-DOS!
  • Ruby is highly portable: it is developed mostly on GNU/Linux, but works on many types of UNIX, Mac OS X, Windows 95/98/Me/NT/2000/XP, DOS, BeOS, OS/2, etc.

Blog at WordPress.com.