Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
660 views
12 pages
SL Unit 2
Uploaded by
Bhargav Raj
AI-enhanced title
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
Download
Save
Save SL unit 2 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
660 views
12 pages
SL Unit 2
Uploaded by
Bhargav Raj
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save SL unit 2 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save SL unit 2 For Later
You are on page 1
/ 12
Search
Fullscreen
| a Lo ONT-2 aS nese Ruby : Rulay is a object - oriented reflective, geneval - popese, dyvanite programming dawg vag . “Ruboy was devcloped fo wake Wh act as a Sensthh “ \yatles lug human Proyawiners the widelyirg | conpidiig woulrinety, bk 4s on awhaapreled seriphing Jarguoge which Meer wosk of obs Fmplemeucedtions execute inshructtons ; Bred fredly, withouwe previews ly, compiling a Progreymn. wo wachiue - Sarguage instuckions “Ruby ‘s used to ceale web applications of Belfer sors. - sslbiyie a extend Roky cotth nec ferboes by * vorthtg cde in Ra 4: Once yout shack odehing ty , \oo-level code wrikken ty C, howevey Me possi Eiht \ -d ate endled, ORaby cbiecks m ke + Evething on Ruby RS cin objeck, and abt variables are selerenced Xo objects Most Ruby okies are seprearnted aa C potvlees to an cea Th Memory thot Conlafa the obeectls \ ‘y dara & tur tmplemacketion dekele. i si, C cote, oD Shave veftrences cae vie. variates 4 ar Value , so when wee pos Rat objects unde you LE doh by passing value. ais. yas one exception For Performance reasons, Ruby Aonplemends Fianums, Symbols, teue, false and, Me yl as so-called Smmedtate vodrer, wort ing wa, some dtake okjecks FLXNUMSCvalue) — > von-se10 tf value fs a TnUM Ang SYMBOL ~Pvalue) — snon-ze10 UY value ts arto ms NUL? (vale) 3 Non-zero % value 7s wil REST (value) —y nowzeo 14 value HY neithe Whig, witht re eWorkirg w% sivas! of a wt a nubl- Gn C, we are wsed Ao coor tig desnivaked! stig’: Ruby shirgs, howeved, age more, genreradl Wary well ‘clude embedded nulla. b yew « Ruby shiny objects ase ackually, veferences to an “a Rstiing: sdrudbare, ANE Reig bucket coda ‘ Vet oo Levath © a porides Feld. We com acces the shrucute via Me Robina macros JNTZNUMC rk) 9 Frere oF Bignamt INT ZELK Gt) a Fremum (faster) CHARLEY Char) A Fanum ale sh Sa- newdCohor ¥) 3 String eas C dokskyges t0 Raley obs ects. ai ———< | RSTRING LEN (sta) — len of fhe Ra wy RSTRING — PTR (sb) 3 Petites to sting storage D RSTRIN GAEND (sty) a Poiwhee toed of shig h “Working with other _ekjeds » . When valuc’s are net immediiade, hey ake 4 » pokes ko one of the predefined Ralky objet I Huck es, 4 The she cluces for Whe baste built in claiges Oe defined tx ralaysh % ase named RClarnarne: 4 PAnay RB QtUNRClass, RDaka, RFile, RF lec, Ria, 9, i RObseck, RReger p, Rsting & RStruck, OL™ Sykelor Etovsten + Tukebor eenge —Fodlenfacng, C code usith rub hy and shattrg, dota and behavioy bewoeen, Lhe hog a wordlds “Weagptig c, sbuckurey« a Woke Deda Whap- struct (value cla, veid (+ wat). p Uy, VEAC¥Fce€)07, void. tp) a — Whos the Gen © data ‘ype pee, vegisters tty 5 two aptloage colleckton veutnes 2 vekvons co volue a Pawlet fo a genuine ruby object. Value Dada_make. Shuck (Vakue dass, ¢ (Hark lO), voi A eee) (), CAype #) —Nllocedex ond seks do 2¢10 a struclue of CB ceeieccemceeereee ete ee ENUF LO ve type: void# y mt $ ie grdfcoded ype fiwsh © Yhon proceeds ox pata rap - Stuck, C-Aype es Ye tame of dada sgpe Wok you've wrapping, nol a vasiable of Yet ee ioe. Gek-Stouck (value obj, ctype, ctype *)_ Reus Ae ovtefrad peter. Daka-Gel-Strucl fsa qyesate Weappes around He wero Pata PTRC) wkidy evalluckes he potter. : Obfeck, Creakion me: - Creaking on, okgeck of claw CPPlag er tn our lash, Raley progiarn ¢ N cd = CDPlayes nreto We Implementation of new in clas is Simple, “A allocakes memos for new objeck © then calls! the objeckls ‘Wikialtve method to wwittalize hak +00 MEMO. ) + So, woe need yo Time evck can allocation fane and can entealtee methed. » Mocakion Funchgoncktons = The allocation function ts responsible for creedking | he The memeny “used ky object. Lue “Sf Ake object ‘naplementirg deawt we amy dota oer Han Rub ‘nstavtee variables, neu You don't wed to vworite an alocat ton. function — Rubys Adoutk ablocutor sill usek gush fhe.| Bok th your clare voraps a © shack el) imeed-tc athorate space jor Wed struck fy 7 Mu allocation tunckion. odes Whe ablocabfon fume" qs pared the class of te pol? dbject bebg alected. 4 2 We allecadGon fume’ cveccteg aun ewgly , unin ‘ale|-* ~ted objec , & we nl ko Kill w specific ree + Clonina, dejecks bl All ruby obbjecls can be copied. Msg one of | wo Me\hods cup and clone. Both produce ante inskance of tutr receiver's claw by calling the | * adlocakion funckion | “Then Ahoy copy across amy ‘nstance variables | from tue original. Clee thon goes ta WA further! ! and copfes dnt original's stn fags . Aten CORINA Abe object's ‘instance vaniables, Ye Awdherpreker Tavolees the newd obgells intlealtie COPY meted, pawing Awa velerence lo \he origind okkecl. wo Xoh tne oxiginall object code checless aos oa Ayre of daha and ~ Has a free func’ lh same addict, as cur dvee find. yOu Wa deter claws andcqagtenny, ection nice iq concn, we weed. do allocate memory ino an j “teuton Yok won't be - object shorage | cu lave o& ant bilmap for a boolean bi pie : Sage, oF ak i of . (ele shkucly! als i elk Raley doesn't use Atecy. | L ~ qo work covsectly With the gpeboae colleclor age | As shold Use the following MeN allecation vouktwes Thee voukines do a (Mle Lik more work Yron Yee shovdard matter func! ante y : Lape * AON Co-Lape, ») w —Mocaked w c-Agpe objecls, where Ape ts | \ the eral name of Ma © type « wot a varias | ee le of that Aype- rthey ' 4 Aye #ALLOC Ce-Ayge) | nu ~Mlocader a c-Aype & cals the resulk toa 28 Powder of Wed {ype taltie. » REALLOC-N (van CAyper n) iin ~Reallocates, Mw CAyes 9 ONsiqus the result | to vag 7& prinber do & Vatiable of Age yp type ¥ ALLOCK Ni Ce type a) —Mocale, memory for Wn objecks on Ye stack — thes vne of CAype | img tik Le eatin Il ~odically freed chen he fume’ tect | evokes ALLOCA nt xehouns, uy |= 11D, 2 < PUES Tye Sytent Sve Raby we sely \ew on Mhe Aype Cor clare), at on chiect and more. on IMs capabilites. This «se! 2 oe Knoon ax Duck Typivg- abe sence, Ducle Typing means an objec Nype ws (oe © defined by had th can do, ne by ubat tt te jae Duck Aygo yefers to dhe Vendeneg of Ral io © be Lew foncemed ith the clay of an object a b More Concerned woth whet methods can be called| WW on Hh & chet opetations can, be pesdouned on | ot ss “ha an Ruby, we would use ¥espond_to 1 os oath : Simply ws an okeck fog methed and know “ the an exception ull be xaised 4{ VA ts used ‘mappropriately Mf an obleck uailks MWe oa Auck ard Aabke Lite a duccle, Yon Ve Ruby ‘Indes preter & Veppy fo Wear, wh os ER wee a duck, <4 Br edkeck. cWhelher he object. Adfanes the Aowste mel >> lA Sing! Spend to } G ost) => dive >> Excephton, MEW. vespord_fol (tog) = false (8 >> a. respond? Close) . ae on => false SY gan \ WA HeeqT above eramplg Isddype eb Buck typig. Ua) gk oO okleck quacte hike a Aude Cor ads Like « Be 4 sting), (ust ae ahead €& teak Wh as a duck Comm 7 fang. Wheneses possttle you shoud tread okje cls vccod to voelhods (rey, define rather than the camer from shich toy trhettd o¢ He modules bs, dhe indud e. & Leddy Ruby do Olney o to @)onbeltire Ruby to ha lovguaae® ; Ke hem yor Fes foot ack Some Ruby code, 74 caf cdlle,| vkdy sermind Yeu of othe Prog armed \erequccen Mm we have used. hs This ts becom of the sya ts fandiliad to wees “ at Perl, Padker, and Java ede, wo ed «Lond Cat Ruby © © have We Waalkuy ssumlbiokte vel ‘fonship, p Silat thet ay Wane te uke, 5 . Shiugs ge in doulle- quotes, reac + Shh are mutable a Sovilatltes | wih Cth! as with Cat, in Reuky mel, public, pavate and protected do Sather sobs. Encepons work Mia sre Keyword vank have (ano cent. wy | sVova 8s moduses t's tested And Ws fast. ak mawnier , Yhough the been charged) to protect theQdingy fcow fava Ad ruby , excep Your code Se som ko ahyvine down considietably. we can also expect i not Ab dake lew Ke to knock together quick Protot athe Re. “pate Swilartler: Ac wilh Gave’, Sn Rub in Memory, fs wromaged fox you via a qesbege ~e colechos. et Objecks are skiovalay Ayped. oe “Thoe ae public, private & prclected! melheds, a Bele. | Ake Pad docs ate Awesome, For thee Peers who wl \ovg, fox elegans, objeck ovented (ecdluves built-in closu from ue beefing Rutey can hep. Qs Swslaidies Ae wily Pest an Rul i _ Porerdheses ate often op\ional code Sheings voor barteably the same. ewte wes PHP: ‘ SPHP ts Kefaticaly ny widespread use for eh | appltcadtons, Buc you won Ao use Ruby on aol at lox Aust wank a lanuoge Yakis: move Laglored S | Sos geneva use, Ruby %s voorlh a leek. oa Siwflacea: As tn PHP, in Ruby ot ee call JRuby % dapawtiallly Ayped, Ske Te PHP, & you ; Aon'k need to wooeg about having to declare Bs He Vastables. i a he ee,a Some vastaloles sel with 4, Mike ‘in PHP (Ld Lay not all) 3 ‘ny Baie ou t OM. Paton as ancthes vey nice gered purpose progre xe larquat: salasties: As wrth Pathon, An Ruby, : - shit Yrerals can Span amuliple Liner like Python wage gushed sbings. tiga me ly od Analy There good suppord fov funckionall proguarnnding wth Kash- claws Func\ions, anonymous funckfons anc closures. OQUrbedig o Bike Seeders San addekton +0 extending Ruby by odding c code, rr can also Aun the problem avound~ 2 ented Rude Asel§ willie your exppticect ion, We can *wherack Ruby by C APL ov by oraluatig Skyingg cornet we eal Ateaet ly eabuakig, cbtigs of Ruby coe Ae ee clalere she Ruy eodecpreks, we weed to call uly. aan) Xo Pek up Command ine aagumenhs ¥ by Rady, Ruby intl Stack to sefup He wuby stack, and yuby-inik 4o Gdtaltee the oF“Arlaps ees Asddh. The cath Xo “vuby “inc boefag” end jadds any Mrechorfes to be searched (os Whecrsieg Thés bind of hands-off wranipulatfon of Rub Proqrarns from wily C code Ys €asy, bul 44 has \uoo waios drawbacks. Pra, as evden. “we rave to Weep sto ving Aevys na alckals 7 extrackivg te values trom thoxe alobals out to use whem, — Second, Wl are not Asiy eu seq evyo checking, wich ust dekinndely Whe us - lake, So, We second vay to trlerack Lith Ruby code %s to Use due C APE. Dcond, we veil wlerack kay cvaluaking c APL | “This ves us much fing qratned| combel ¢ takso leks us handle esrors, ble can do {his hy inihetb.lea ag the Swherpeley as Nomal. Then, vetho, than evaluating ctrngs, ‘nslead Invoke specific metheds In yours Ruby | code. Athen “hese methabs velusn your C code gets covtvo | back, Le vor ast pe woke —4 c vor caaill4, “ewibelled xg \ a ae wd abe oe as aderpreker. qhis Junc she we calhe before ony, other wl related functions, ed rath “nih eagle) — Aelkaltees Whe Qs vathalde , mecersand CY your code \cods cou Wlreng rocdules. word wha options Grd asge, cha ean) b — Ges We aby ankerpreler Ye commande copious. Voth vuloy- serfph char % nana) | —scds Me vame of the vulby scfiph fo raw. —leads We queen frle &vdo Ye iwcer preler , a VARA subytunt): ~ Runs we indevpreter ved swhy—frolkret ) — vshuds down ‘he iwdeapreler.
You might also like
SL Unit-2
PDF
No ratings yet
SL Unit-2
20 pages
Scripting Languages U-5
PDF
No ratings yet
Scripting Languages U-5
42 pages
SL 1,2,4
PDF
No ratings yet
SL 1,2,4
20 pages
Unit5 TCL
PDF
No ratings yet
Unit5 TCL
24 pages
FIoT Unit 03
PDF
No ratings yet
FIoT Unit 03
74 pages
SL Unit-5
PDF
No ratings yet
SL Unit-5
63 pages
Flat - Unit 3
PDF
No ratings yet
Flat - Unit 3
18 pages
SL Unit-V
PDF
No ratings yet
SL Unit-V
85 pages
ML Unit-4
PDF
No ratings yet
ML Unit-4
17 pages
Illustrate The Embedding of Ruby To Other Languages Like C
PDF
No ratings yet
Illustrate The Embedding of Ruby To Other Languages Like C
9 pages
Ai - Unit - 3-1
PDF
No ratings yet
Ai - Unit - 3-1
31 pages
Unit 2
PDF
No ratings yet
Unit 2
48 pages
SL Unit-1 Notes!-1
PDF
No ratings yet
SL Unit-1 Notes!-1
21 pages
Sl-Unit 3
PDF
No ratings yet
Sl-Unit 3
22 pages
SL Unit 3
PDF
No ratings yet
SL Unit 3
24 pages
Flat Notes
PDF
No ratings yet
Flat Notes
111 pages
ML Unit-2
PDF
100% (1)
ML Unit-2
28 pages
Reasons For Studying Concepts
PDF
100% (1)
Reasons For Studying Concepts
2 pages
IDS-Unit 3
PDF
No ratings yet
IDS-Unit 3
142 pages
Automata - Structural Representation
PDF
No ratings yet
Automata - Structural Representation
12 pages
FIoT Unit 04
PDF
100% (1)
FIoT Unit 04
65 pages
Optimal Decision in Games
PDF
No ratings yet
Optimal Decision in Games
68 pages
ML Unit-3
PDF
No ratings yet
ML Unit-3
23 pages
STM Unit 3 Notes
PDF
No ratings yet
STM Unit 3 Notes
36 pages
SL Unit I
PDF
No ratings yet
SL Unit I
12 pages
Scripting Languages Unit - V Handwritten Notes
PDF
No ratings yet
Scripting Languages Unit - V Handwritten Notes
37 pages
ML Lab Mannual R22 Cse (DS)
PDF
No ratings yet
ML Lab Mannual R22 Cse (DS)
46 pages
FIOT Unit-1 Notes
PDF
No ratings yet
FIOT Unit-1 Notes
27 pages
STM Unit 5
PDF
No ratings yet
STM Unit 5
31 pages
Cse Flat Digital Notes Full 2020 21
PDF
No ratings yet
Cse Flat Digital Notes Full 2020 21
195 pages
ML Unit 1
PDF
No ratings yet
ML Unit 1
42 pages
ML Unit-1
PDF
100% (1)
ML Unit-1
15 pages
JNTUH FLAT Study Material
PDF
No ratings yet
JNTUH FLAT Study Material
211 pages
Representing Knowledge in An Uncertain Domain IN AI: Bayesian Networks
PDF
No ratings yet
Representing Knowledge in An Uncertain Domain IN AI: Bayesian Networks
7 pages
DAA Notes
PDF
No ratings yet
DAA Notes
126 pages
ML Unit 4
PDF
No ratings yet
ML Unit 4
50 pages
Path, Path Products and Regular Expressions - G9
PDF
No ratings yet
Path, Path Products and Regular Expressions - G9
37 pages
Flat Unit 1 Notes
PDF
0% (1)
Flat Unit 1 Notes
18 pages
4.3 A Ontological Engineering in Artificial Intelligence
PDF
100% (2)
4.3 A Ontological Engineering in Artificial Intelligence
5 pages
Applications of Context Free Grammars
PDF
No ratings yet
Applications of Context Free Grammars
23 pages
Scripting Language
PDF
No ratings yet
Scripting Language
55 pages
SL Unit-3 Notes!
PDF
100% (1)
SL Unit-3 Notes!
19 pages
FLAT - UNIT 1 Notes
PDF
100% (2)
FLAT - UNIT 1 Notes
18 pages
Jntu SL Lab Manual
PDF
No ratings yet
Jntu SL Lab Manual
33 pages
ML Unit-5
PDF
No ratings yet
ML Unit-5
14 pages
Flat - Unit - 4 Notes
PDF
No ratings yet
Flat - Unit - 4 Notes
20 pages
21cs502 Unit 4 Ai Notes Short
PDF
No ratings yet
21cs502 Unit 4 Ai Notes Short
32 pages
Flat (Complete Notes)
PDF
No ratings yet
Flat (Complete Notes)
91 pages
ML Unit 3 New
PDF
100% (1)
ML Unit 3 New
24 pages
STM Unit-4
PDF
No ratings yet
STM Unit-4
36 pages
Unit-4object Segmentation Regression Vs Segmentation Supervised and Unsupervised Learning Tree Building Regression Classification Overfitting Pruning and Complexity Multiple Decision Trees
PDF
No ratings yet
Unit-4object Segmentation Regression Vs Segmentation Supervised and Unsupervised Learning Tree Building Regression Classification Overfitting Pruning and Complexity Multiple Decision Trees
25 pages
States, State Graphs, and Transition Testing: Unit Iv
PDF
No ratings yet
States, State Graphs, and Transition Testing: Unit Iv
42 pages
Dbms Lab Manual II Cse II Sem
PDF
No ratings yet
Dbms Lab Manual II Cse II Sem
58 pages
Reasoning With Default Information
PDF
No ratings yet
Reasoning With Default Information
3 pages
Unit 3
PDF
No ratings yet
Unit 3
68 pages
Mrit Devops Full Notes PDF
PDF
No ratings yet
Mrit Devops Full Notes PDF
214 pages
PPL Unit-1
PDF
100% (1)
PPL Unit-1
19 pages
R18 CSM 3-2 Devops
PDF
No ratings yet
R18 CSM 3-2 Devops
28 pages
Guarded Commands
PDF
No ratings yet
Guarded Commands
9 pages
Undecidable Problems For Recursively Enumerable Languages: Continued
PDF
No ratings yet
Undecidable Problems For Recursively Enumerable Languages: Continued
54 pages
847 ©TheOne Class-1 Strategy Simplification BODMAS
PDF
No ratings yet
847 ©TheOne Class-1 Strategy Simplification BODMAS
91 pages
SL Notes
PDF
No ratings yet
SL Notes
56 pages
Online Pharmacy Management
PDF
No ratings yet
Online Pharmacy Management
7 pages
Pre Samiksha Test 2 Question Paper
PDF
No ratings yet
Pre Samiksha Test 2 Question Paper
18 pages
046 Success in Prelims 2023 SIP Today's Class Advance PPT at
PDF
No ratings yet
046 Success in Prelims 2023 SIP Today's Class Advance PPT at
104 pages
021 ©TheOne Mixture and Allegation (Eng)
PDF
No ratings yet
021 ©TheOne Mixture and Allegation (Eng)
7 pages
1015 ©TheOne Surds and Indices (Eng) Drona Batch
PDF
No ratings yet
1015 ©TheOne Surds and Indices (Eng) Drona Batch
10 pages
106 Success in Prelims 2023 SIP Today's Class Advance PPT at
PDF
No ratings yet
106 Success in Prelims 2023 SIP Today's Class Advance PPT at
67 pages
019 ©TheOne Partnership (Eng)
PDF
No ratings yet
019 ©TheOne Partnership (Eng)
7 pages
003) Crisp Copy of Laxmikant
PDF
No ratings yet
003) Crisp Copy of Laxmikant
116 pages
07 Jan 2024 Test QP
PDF
No ratings yet
07 Jan 2024 Test QP
12 pages
Agriculture by Amit Garg
PDF
No ratings yet
Agriculture by Amit Garg
82 pages
Malware Analyst Professional - Level 1 Syllabus
PDF
No ratings yet
Malware Analyst Professional - Level 1 Syllabus
3 pages
Pre Samiksha Test-2 Question Paper
PDF
No ratings yet
Pre Samiksha Test-2 Question Paper
20 pages
Sci & Tech Booklet - 2 2024
PDF
No ratings yet
Sci & Tech Booklet - 2 2024
47 pages
065 ©TheOne Calculation Module For Practice - 1 With Answers
PDF
No ratings yet
065 ©TheOne Calculation Module For Practice - 1 With Answers
56 pages
Sci & Tech Booklet - 1 2024
PDF
No ratings yet
Sci & Tech Booklet - 1 2024
48 pages
B.Tech 4-2 R18 Timetables
PDF
No ratings yet
B.Tech 4-2 R18 Timetables
22 pages
Species Static + CA + UPDATED PT@ Clear Vision For UPSC
PDF
No ratings yet
Species Static + CA + UPDATED PT@ Clear Vision For UPSC
57 pages
Modern History Part 01 - Revise Through 400+ MCQs - Solutio
PDF
No ratings yet
Modern History Part 01 - Revise Through 400+ MCQs - Solutio
63 pages
Mapping Geo
PDF
No ratings yet
Mapping Geo
17 pages
Environment - Revise Through 400+ MCQs - Solutions - 2024 P
PDF
No ratings yet
Environment - Revise Through 400+ MCQs - Solutions - 2024 P
145 pages