Reting Dopokan:
  • 0 meon suara - 0 Rata-rata
  • 1
  • 2
  • 3
  • 4
  • 5
Beginning Ruby Tutorial
09-04-2011, 01:30 AM,
Posting: #1
Beginning Ruby Tutorial
Lagi galau pengin urek2 bae ning TCC.

Ruby kuwe apa maning donge? Ruby kuwe salah satu bahasa pemrograman berbasis objek. Klaim sing nggawe ruby jarene, kabeh sing ana ning ruby kuwe object.

Ruby kuwe bahasa sing serba mirip2.. wanna be ngonong lah jare kanca adoh. Mirip2 smalltalk, mirip2 python, mirip2 perl.

Kye ta mein tutorial nginstalle disit bae yah.

Nginstall ning windows
Dong ning windows, sampeyan bisa nganggo sing arane ruby installer. Cara nginstalle kaya software2 liyane. Kari klak-klik tok.
Download bae installer e ning kene : http://rubyinstaller.org/downloads/
Pilih bae sing versi 1.9.2 stable paling anyar.

Nginstall ning Linux/OSX
Ning nang Linux atau OSX ta saranna nginstall lewat rvm. Rvm kuwe singkatan sekan Ruby Version Manager. Ning nganggo rvm kiye, dewek bisa nginstall beberapa versi ruby, dadi kepenak ning ana perlu apa2.

Ning nganggo rvm, gelem ra gelem paling enak komputer lagi konek maring internet.
Cara nginstall selengkape deleng nang kene bae ya : https://rvm.beginrescueend.com/rvm/install/
Bokan ana error2 monggo ditakonna nang kene bae.

Ruby Tutorial
Tutorial kiye nyong nggawe berdasarkan http://tryruby.org/
Bokan ana sing kangelan nginstall ruby ning komputere ya langsung bae maring situs http://tryruby.org. Ngko nang kana bisa langsung coding2 ruby. Nggo sing wis nginstall ruby, buka command line/terminal terus jalanna irb.

Ruby Expression
Ekspresi ning ruby pada bae karo ning bahasa2 liyane. Bedane, ning ruby, ekspresi kuwe bisa ditulis apa anane tanpa perlu ketergantungan maring liyane. Terus nang ruby, ekspresi kuwe mesti mein nilai balik.
Kode:
>> 2 + 6                                                                
=> 8
Monggo dicoba2 ekspresi liyane. + - / *

Nah nang ruby kan kabeh kuwe object. Contone coba gawe string biasa.
Kode:
>> "Jimmy"                                                              
=> "Jimmy"
Sing arane object kan biasane ana method2 e oya?
Nah string mau "Jimmy" kuwe merupakan suatu object. Salah satu method sing didueni daning object string kuwe reverse. Akeh maning sing liyane.
Kode:
>> "Jimmy".reverse                                                      
=> "ymmiJ"
>> "Jimmy".length                                                      
=> 5

Konversi tipe data/class
Ning pengin nglakukan konversi misal sekan integer maring string bisa dilakukan nganggo method sing sesuai karo object e. Misal:
Kode:
>> 40.to_s.reverse                                                      
=> "04"
Sing liyane ana to_i nggo maring integer. to_a nggo maring array.

Arrays
Array, ato bisa juga disebut list. dicirikna nganggo kurung kotak []. Misal gawe array :
Kode:
>> []                                                                  
=> []                                                                  
>> [12, 35, 13]                                                        
=> [12, 35, 13]
Nah list kuwe juga object, duwe method juga. Misal:
Kode:
>> [12, 35, 13].max                                                    
=> 35

Assignments
Assignment ning ruby nganggone tanda =
Kode:
>> tiket = [12, 35, 13]                                                
=> [12, 35, 13]

Tanda pentung! Tanda tanya?
Ning ruby ana method2 sing bisa nganggo tanda pentung karo tanda tanya. Biasane tanda pentung karo tanda tanya kuwe nandani bahwa hasil sekan method kuwe bakal mempengaruhi isi object e.
Kode:
>> tiket                                                                
=> [12, 35, 13]                                                        
>> tiket.sort!                                                          
=> [12, 13, 35]                                                        
>> tiket                                                                
=> [12, 13, 35]                                                        
>> tiket.shuffle!                                                      
=> [13, 12, 35]                                                        
>> tiket.sort                                                          
=> [12, 13, 35]                                                        
>> tiket                                                                
=> [13, 12, 35]

wis ah samono disit ya.. ngko gampang dilanjut maning. Bokan ana pertanyaan ato saran monggo. aja dikritik wa, mesih anyar belajaran.. Nyengir
Perokok itu penjahat, harus dimusnahkan.
terima kasih telah membuang asap pada tempatnya.

Add Thank You
[+] 5 users say Thank You to tkid for this post
07-05-2011, 09:26 AM,
Posting: #2
RE: Beginning Ruby Tutorial
nice share .. paham akune .. klepon + [Gambar: postbit_ty_add.gif] teka Es Teh
Never pretend to be others, cause what you see is just a piece of their life, not the whole of their life (R. Imani ; 2011)

Add Thank You
07-05-2011, 10:40 AM,
Posting: #3
RE: Beginning Ruby Tutorial
wah dadi semangat kyeh nyong.. tunggu update e ya kang. hehe suwun.. Es Teh
Perokok itu penjahat, harus dimusnahkan.
terima kasih telah membuang asap pada tempatnya.

Add Thank You
10-06-2011, 03:12 AM, (Postingan kiye terakhir diubah : 10-06-2011, 03:16 AM {2} daning ImaniMbe007. Edit Reason: )
Posting: #4
RE: Beginning Ruby Tutorial
um daning aku nyoba Try Ruby, eror bae ya? Ngukuri batuk
Never pretend to be others, cause what you see is just a piece of their life, not the whole of their life (R. Imani ; 2011)

Add Thank You
10-06-2011, 11:56 AM,
Posting: #5
RE: Beginning Ruby Tutorial
wah server e lagi down nean um. hehe.

mending langsung install ning komputer baen.
kowen nganggo apa? windows ato linux?
Perokok itu penjahat, harus dimusnahkan.
terima kasih telah membuang asap pada tempatnya.

Add Thank You


Maring Forum:


Hubungi Kami | Forume Wong Tegal lan Sekitare | Menduwur | Maring Konten | Mobile Version | Sindikasi RSS