Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
1Activity
P. 1
Little Book of Ruby

Little Book of Ruby

Ratings: (0)|Views: 8|Likes:
Published by birbal

More info:

Published by: birbal on Dec 17, 2007
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/12/2011

pdf

text

original

 
Y
OUR
F
REE
G
UIDE
T
O
P
ROGRAMMING
R
UBYFROM
.
.
IN
 
ASSOCIATION
 
WITH
 
B
ITWISE
M
AGAZINE
 
The Little Book Of Ruby :: ::www.sapphiresteel.com:: page 2
The Little Book Of Ruby
Copyright © 2006 Dark Neon Ltd.All rights reserved.
written by
Huw CollingbourneDownload source code from:http://www.sapphiresteel.comYou may freely copy and distribute this eBook as long as you do not modifythe text or remove this copyright notice. You must not make any charge forthis eBook.The Little Book of Ruby is produced in association with Rosedown Mill Ltd.,makers of the Steel IDE for Visual Studio (www.sapphiresteel.com) andBitwise Magazine – the online magazine for developers(www.bitwisemag.com
 
).First edition: June 2006
 
The Little Book Of Ruby :: ::www.sapphiresteel.com:: page 3
Table of Contents
Welcome To The Little Book Of Ruby...........................................................................5Learn Ruby In Ten Chapters…..............................................................................5What Is Ruby?.......................................................................................................5What Is Rails?........................................................................................................5Download Ruby plus an Editor ..............................................................................6Get The Source Code Of The Sample Programs...................................................6Running Ruby Programs........................................................................................6How To Use This Book ..........................................................................................7Making Sense Of The Text....................................................................................7Chapter One.....................................................................................................................8Strings and Embedded Evaluation.......................................................................11Methods...............................................................................................................12 Numbers...............................................................................................................14Testing a Condition: if … then.............................................................................15Chapter Two..................................................................................................................17Instances and Instance Variables..........................................................................18Constructors – new and initialize.........................................................................21Inspecting Objects................................................................................................22Chapter Three................................................................................................................25Superclasses and Subclasses................................................................................28Chapter Four .................................................................................................................30Accessor Methods................................................................................................30Attribute Readers and Writers..............................................................................32Attributes Create Variables..................................................................................34Calling Methods of a Superclass.........................................................................37Class Variables.....................................................................................................38Chapter Five..................................................................................................................40Using Arrays........................................................................................................40Creating Arrays....................................................................................................41Multi-Dimensional Arrays...................................................................................43Iterating Over Arrays...........................................................................................45Indexing Into Arrays............................................................................................46Chapter Six....................................................................................................................48Creating Hashes...................................................................................................48Indexing Into A Hash...........................................................................................50

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->