0 ratings0% found this document useful (0 votes) 93 views8 pagesSL Unit-1 Introduction
Unrelated content . Need more content
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
F ... ONIT=t : Oe
x Qatroduction :
2 guby
Ruby ts a scripting language designed by
yukhiromatsumto » also Known as Matz at 1993
40 Japan:
+ 9 18 a pure OOF
DL runs on a Vvaxiety of platforms, such as
windows , Mac 0S, and vastus eisions of
UNIX :
Features of Ruby : ,
-» Ruby 18 ,an open Source and ts Freely available
on web , bub it i Subjech to a License
ES Ruby tS generod purpose - foterpreted Programming
Language ,
+ Ot is +rue object oriented Programming lang
+O iS a Pegvensice detipling language sjamilan to
python & PERL
* Ruby wan be used to write ‘common Grakewoay
Scripts (G8) t
"PL can be embeded Ynth yr
> OI
has a clean & easy ayotar ‘aod allows ot,
"developer to Learn vou quickly § easily
has sttlay Syntax tp hast of many
Megrammingi: language such as, C+) perl.
+44 ij
ar
Ee ot 5
pce
| written 4 Ruby are
(3 Ob ts used -for developing
Onkernet applicactions : aD }
3 Oy tan ve installed 40 Ubtadows and POSIX
oe
much scalable and “63 | programs
easily mainiatna
aoternet, and’
environments: i
+> 91 supporls many Gul doolS such as Tei[ Tk,
Gtk § OPENGL
> 4 can be connected 4p «DBs,
Sybase
Ot has rich Set
atrectly oto Rubg scripts
Mysal , oracle
of built 19 dunctons, dohid
can be used
J2c00 ‘or ‘Usind oo HO
Tools you will eed :
> Linux [ windows an [a8
iq
+ pfuby 18
DE fo orn Open Source object orvented SL tov
by yukjhiro Matsumoto:
aq HE aid 90'S
“Ruby 2netalldtion “in Liour i
* To anolol Ruby fron the default Ubuntu
respositortes follow these Steps :
0 Ciret, update tthe pakages 4odew 2
Sudo opt update
S Dn6tall Ruby by Fyping :
5 i ty Sudo apt tostall auiby
6 3) to wenify. that the 4 :
| . in Bball action ‘t wos:suecsetul rua thes Following’ Commang .*
‘ll print Ruby | YeIsion » 4
wuby -— =VEISI0O
a) The outpel will, look, Something meek
nuby DB (POF (0018 03-29) vereviisia.9 (3024) ,
a swak Boole [xsse6uttout-gou]
ae Be ae
yee te vik 4 Ly" ea
chaniacteristics of Ruby :- \ \
ee : . ae
Ly object onientedt 3) Culb Hoe
94, %6 puriely obfect oriented programming long
Md acs sey AL ja
tach & every value ag an object «Even object “hor
iris oe
a class & MeL das has. Super Cae
bev kerad . dvbea |
| cedle has thet, propedies, 4 actions - :
401 495 influenced with Smebtalk Smaltalk lang:
1 RE eR Page ‘Gdisk yp
| ¥
+ Fleatbility ? ee
a iS flexible lang as “you can éa'stly'
remove , redefine Ot odd existing pads! 0 i
yaks sua? prior Vt
+ Miaios |
fe bas features\leri ingle toberttarce oolys
Luby has clases |) Asi) well as! modules } |
SA modules ‘have \imethods buh, 92 en stances... “4
brqaey slog iene dol)
> Vistual appearance! insienis fs
Di generally prefers engtah, keyword 2 ©
fora Puntuations 95 used; to “de carat Ruled:
2 does ood peed variable ecloxalt
oeB
AP Dynancte § Duck typing '-
> Ot 4s aynartic programming lang
7% Ruby pragraco are not compiled »
+ AN classes , module & method definition are §
bail lb by the code when 44 run:
¥ Ruby variables are loosely typed language »
which — means any wevdable can hold ony fype 4
of object: pond be oiBevorn ©
“3 Alben 0 method % called 09 ‘ao ‘object,
of the type
Ruby ool
jlooks up at the fame terespec tive
of object - , X
Svasxtable constants +
+ 2p ruby, ‘censtants are ot
Hint Paced “4ettialiged constant
modified fo a aevip? uot Simply
bed will not balt your program
“nigger %
waxNioF z
+ Naming Conve ctions : Vea
D1 defines some naming conventions,
4s nasiables |, methods , constant & class |,
» constant: stax with ‘capital Lethes, iva
« Global vasiable | dlarls wilh doles .sign( $)
% ODnsiance vasdable: Stards: with @) sign
* class vasdable t stasts with *(@@) sig
» Method mame: Allowed to stark with call
leer
i i
Span RE ki a:e keyword anquments :
tilee pythoo,, Fab y Method can also, be
defined using Keyword —axqeiments
case Bensitive : '
1) 45 case SerSitive lang: Nowercase letters g
apperease Letters are different:
Keywords : On Ruby +there are approximately 42
keyouorA 5, which can be Moca for other ae
They are called reserved words
statement delimiters: multtéple’ Stotements in ia.
Single tok must contain semicolon to blo but
not at the end of oe
* Ruby oo Rails t
> ot a worttte 0 40 Dee pegenntog language
+ domme “of hep ponpltke are “Ruby oo Railo's
Rhoda sinatra ou banarni . Scourged eal bas
Ly rol boa r
and emmany more
~ Ruby on Rails 6 the rns popetlon foes frame-
-wotk for Ruby SOL! }
~ De i5 a $40 Black Web development Framework;
comes with features 40 facilitate ‘both client
Side cand server side adeb \developrbenk- |
> Op provides basic Structure required by Aevelopy
_ to create wel pages , web Services and De also.> Dt enables Aevelope
doint TML,
emterfaces bY st ed ;
Rots devel
build user
Towa script g xt ‘also Ruby 0”
have the option to add functionality’ 40 the
application coi thgeat wortting additional code by |
using a vauity Of robust Ruby gems:
+ Pt supports. high level s/w engineering ‘in
2p Why use Ruby on Rails
) Pee-coded Framework: ‘
DL has pre coded Frame voorks a0
Like Ruby on tails G chef now you wae ¢
rsonal o
a Horosd
4his @5 00 enteasion for your own Fe
professional projects Rg pot Oe
3 Dt has % own ecosystem -to manage Hide
and, predebtHe produce named +the ruby gens
Adhere are presently over 60,000 Ubrauties 1+
&) Documentation and Support
Monual plays a significant role 4a cud
develops Ute
Developer pill be starfing hy
4o¢ documentation oa
GU are | just dresing to
cmnect yout Datahase
atrect| y to document3) teorsng dtub. +
DL has laxge amounts of learsing beta
“om wich ‘you ean choose), here is pleoly of books
A) community +
Dt made full (with deuelopers wobo
tove helping outs toobs make sure you give
wack ‘once
.). Rails framecoork : ‘
Framework 25 a a pager oct an programs ov
code tioray shat writes many of goor apltcabion
it
3 Ruby 0 Rails) is) MVC Framework
he model Mew certoller framework isa desigo
for idevelopieg appli ‘cadion A ’
+ MVC priociple divides “4the ‘work of (a4 app* toto
9,
& Seperate loud closely cBopercttiv é Bubsqstens
OModel: +his maintains the ‘relationship | bho!
the objects ard DB “handles ‘validations ,'
asso tations transactions § more»
> Dt 45 ‘implemented 40 active record Uibraxey
which provides an Anterface gi bidding “ables
in a relational PB g “Ruby prog ‘eode code 4bat
Manipulades DB records -
t Puloy method names are automatically generated
fiom fields names of DR tables
4 capital Ss iViews I
s Obs a presentattion
of dalalin a povtcutan
Forrrad thiggered oy contioll
decision to present “the
data , they are Bcript based
template systems ike TSP,
Oe PHP & very easy to ‘inteq
tech: OF ‘Ss Amplemented fn action view |Libray
controller :- ue eae
Facility wotthio “the airbnb , &
-camkolter _etiod
conboller metho
iHhu , hue 5a
aeny cetned BERRE” 00 Gyuchtieg Abe no
pec fc kick. Stasder dada § 00 other hand
orqariging that, daja ‘ne 4 “fore thot RIS 4
the ‘needs joF a given viecd"
4n action cenkcller obi
5 Dt 49 implemented
ng ble active record
es a data broken oitti
yand at yous, /
=> Mnstablation + o
+ Ruby a Ralls fiamework 4 web Servet y