SlideShare a Scribd company logo
1 of 2
Ruby Talk – An Introduction to




          Premshree Pillai
        premshree@livejournal.com
Scope of Talk
        What this talk is and what it isn’t
        Me, myself
        What is?
        Why use?
        How to? (a quick run through the syntax)
        Quick comparisons (with Perl and Python)
        Resources


Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004   2

More Related Content

What's hot

New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_viNico Ludwig
 
Ekon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsEkon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsArnaud Bouchez
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in RubyRoss Lawley
 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHBhavsingh Maloth
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Kostis Sagonas: Cool Tools for Modern Erlang Program Developmen
Kostis Sagonas: Cool Tools for Modern Erlang Program DevelopmenKostis Sagonas: Cool Tools for Modern Erlang Program Developmen
Kostis Sagonas: Cool Tools for Modern Erlang Program DevelopmenKonstantin Sorokin
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
The dark side of Ruby, or Learn functional programming with Ruby
The dark side of Ruby, or Learn functional programming with RubyThe dark side of Ruby, or Learn functional programming with Ruby
The dark side of Ruby, or Learn functional programming with RubyEvgeny Garlukovich
 
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...DaeHyun Sung
 
I Know Kung Fu - Juggling Java Bytecode
I Know Kung Fu - Juggling Java BytecodeI Know Kung Fu - Juggling Java Bytecode
I Know Kung Fu - Juggling Java BytecodeAlexander Shopov
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvmTao He
 
Getting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeGetting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeLihang Li
 
Lifting The Veil - Reading Java Bytecode During Lunchtime
Lifting The Veil - Reading Java Bytecode During LunchtimeLifting The Veil - Reading Java Bytecode During Lunchtime
Lifting The Veil - Reading Java Bytecode During LunchtimeAlexander Shopov
 
A peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserA peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserKoan-Sin Tan
 

What's hot (19)

New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
 
Ekon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsEkon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side Notifications
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Kostis Sagonas: Cool Tools for Modern Erlang Program Developmen
Kostis Sagonas: Cool Tools for Modern Erlang Program DevelopmenKostis Sagonas: Cool Tools for Modern Erlang Program Developmen
Kostis Sagonas: Cool Tools for Modern Erlang Program Developmen
 
Protocol Buffer.ppt
Protocol Buffer.pptProtocol Buffer.ppt
Protocol Buffer.ppt
 
Ruby golightly
Ruby golightlyRuby golightly
Ruby golightly
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
C++ programming
C++ programmingC++ programming
C++ programming
 
The dark side of Ruby, or Learn functional programming with Ruby
The dark side of Ruby, or Learn functional programming with RubyThe dark side of Ruby, or Learn functional programming with Ruby
The dark side of Ruby, or Learn functional programming with Ruby
 
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
 
I Know Kung Fu - Juggling Java Bytecode
I Know Kung Fu - Juggling Java BytecodeI Know Kung Fu - Juggling Java Bytecode
I Know Kung Fu - Juggling Java Bytecode
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvm
 
Getting started with Linux and Python by Caffe
Getting started with Linux and Python by CaffeGetting started with Linux and Python by Caffe
Getting started with Linux and Python by Caffe
 
Dancing with dalvik
Dancing with dalvikDancing with dalvik
Dancing with dalvik
 
Lifting The Veil - Reading Java Bytecode During Lunchtime
Lifting The Veil - Reading Java Bytecode During LunchtimeLifting The Veil - Reading Java Bytecode During Lunchtime
Lifting The Veil - Reading Java Bytecode During Lunchtime
 
A peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserA peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk User
 

Similar to P4 P Update January 2009

Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Rormyuser
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Muhammad Haseeb Shahid
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9sagaroceanic11
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9sagaroceanic11
 
Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Oregon Law Practice Management
 
Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Alejandra Perez
 
Jerry Shea Resume And Addendum 5 2 09
Jerry  Shea Resume And Addendum 5 2 09Jerry  Shea Resume And Addendum 5 2 09
Jerry Shea Resume And Addendum 5 2 09gshea11
 
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangMajlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangImsamad
 
Agapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAgapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAntonio Silva
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorialknoppix
 

Similar to P4 P Update January 2009 (20)

Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Intro for RoR
Intro for RoRIntro for RoR
Intro for RoR
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
Ruby
RubyRuby
Ruby
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
l-rubysocks-a4
l-rubysocks-a4l-rubysocks-a4
l-rubysocks-a4
 
l-rubysocks-a4
l-rubysocks-a4l-rubysocks-a4
l-rubysocks-a4
 
MMBJ Shanzhai Culture
MMBJ Shanzhai CultureMMBJ Shanzhai Culture
MMBJ Shanzhai Culture
 
Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5
 
Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1
 
Jerry Shea Resume And Addendum 5 2 09
Jerry  Shea Resume And Addendum 5 2 09Jerry  Shea Resume And Addendum 5 2 09
Jerry Shea Resume And Addendum 5 2 09
 
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangMajlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
 
Agapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAgapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.com
 
LoteríA Correcta
LoteríA CorrectaLoteríA Correcta
LoteríA Correcta
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorial
 
Ruby Hell Yeah
Ruby Hell YeahRuby Hell Yeah
Ruby Hell Yeah
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Recently uploaded (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

P4 P Update January 2009

  • 1. Ruby Talk – An Introduction to Premshree Pillai premshree@livejournal.com
  • 2. Scope of Talk What this talk is and what it isn’t Me, myself What is? Why use? How to? (a quick run through the syntax) Quick comparisons (with Perl and Python) Resources Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 2
  • 3. Purpose What this talk is? Get you interested Get you started with Ruby What it isn’t? Not a tutorial Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 3
  • 4. Who am I? (or why should you listen to me) 21/male/single :) Technology consultant Freelance writer since 2001 Perl/Python/Ruby/REBOL hacker Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 4
  • 5. History (Ruby’s, not mine) Created (in Japan) by Yukihiro Matsumoto, popularly called Matz Named as “Ruby” to reflect its Perl hertitage Released to the public in 1995 Licensed under GPL or Ruby terms Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 5
  • 6. What the heck is Ruby? An object-oriented “scripting” language As powerful as Perl; simpler, better OO The simplicity of Python Follows the principle of “Least Surprise” – What You Expect Is What You Get Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 6
  • 7. Where can you use Ruby? System (n/w, RegExps) Web programming (using CGI)  Agents, crawlers DB programming (using DBI) GUI (Tk, RubyMagick) Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 7
  • 8. General Features High level language True OO (everything’s an object!) Interpreted Portable Low learning curve A quick scan thro’ the syntax Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 8
  • 9. Running Ruby From the command line: ruby file.rb Windows binary comes bundled with Scintilla Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 9
  • 10. Basic stuff print 'Hello, world!' p 'Hello, world!' # prints with newline my_var = gets # get input Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 10
  • 11. Operators (addition) + - (subtraction/negation) * (multiplication) / (division) % (modulus) ** (exponentiation) Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 11
  • 12. Operators (contd.) == <=> (returns -1, 0 or 1) <, <=, >=, > =~ (matching) eql? (test of equality of type and values) Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 12
  • 13. Operators (contd.) ++ and -- are not reserved operators Use += and +- Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 13
  • 14. Logical Operators and or not Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 14
  • 15. Typing Dynamic typed  Type checking at run-time Strong typed Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 15
  • 16. Basic Data Types Integers and floats Strings Ranges Arrays Hashes Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 16
  • 17. Strings my_str = 'whatever' my_str = quot;blah, blahquot; my_str.split(quot;,quot;)[0].split(quot;quot;)[2] * 3 Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 17
  • 18. Ranges Inclusive range my_range = 1 .. 3 my_range = 'abc' .. 'abf' Non-inclusive range my_range = 1 … 5 my_range = 'abc' … 'abf' Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 18
  • 19. Arrays my_array = [1, 2, 3] Common methods: my_array.length my_array << 4 my_array[0], etc. Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 19
  • 20. Hashes my_hash = { 'desc' => {'color' => 'blue',}, 1 => [1, 2, 3] } print my_hash['desc']['color'] will return blue Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 20
  • 21. Hashes (contd.) Common methods: my_hash.keys my_hash.values Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 21
  • 22. Data Type Conversion Converting to an Array: var_data_type.to_a Converting to an String: var_data_type.to_s More (guess!): var_data_type.to_i var_data_type.to_f Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 22
  • 23. Everything's an Object Methods can be applied to data directly – not just on variables holding data Example: 5.to_s will return quot;5quot; Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 23
  • 24. Code Blocks Code blocks may use braces ( { } ) or do/end Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 24
  • 25. Code Blocks (contd.) Example def my_print(what) print what end You cannot use braces for function blocks Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 25
  • 26. If Statement if expression code block elsif (expression) code block else code block end Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 26
  • 27. While Statement while expression code block end Example: count = 1 while count < 10 print count count += 1 end Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 27
  • 28. For Loop for variable_name in range code block end Example: for count in 0..2 print count end Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 28
  • 29. Iterators array_or_range = value array_or_range.each { |x| print x } Example: my_range = 1..5 my_range.each { |x| print x } Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 29
  • 30. Functions Functions begin with the keyword def def function_name([args]) code block end Example: def print_name(name='Ruby') print name end Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 30
  • 31. OO Ruby Classes are containers for static data members and functions Declared using the class keyword. All class names should begin with a capital letter Constructor declared using the initialize keyword Class variables precede with an “@” Objects created using the new method Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 31
  • 32. Example class class My_class def initialize(arg1, arg2) @arg1 = arg1 @arg2 = arg1 end def print_arg1() print @arg1 end def print_foo() print quot;I Love Ruby!quot; end private def print_arg2() print @arg2 end end my_object = My_class.new(2, 3) my_object.print_arg1 my_object.print_arg2 # will cause an exception Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 32
  • 33. Inheritance class Derived_class < My_class def initialize() @arg = quot;I Love Ruby!quot; end def print_arg() print @arg end end my_object = Derived_class.new my_object.print_foo Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 33
  • 34. Notes on OO Ruby Access specifiers: public, protected, private Multiple inheritance not possible Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 34
  • 35. Ruby modules require 'net/http' superclass subclass Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 35
  • 36. Advanced topics Regular expressions Network programming MT programming GUI programming (using Tk) Web programming Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 36
  • 37. Now what? What you can do now? Get your hands dirty with Ruby Write simple Ruby programs What you have to do? Explore Ruby modules Find a problem, and Ruby it! Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 37
  • 38. Perl compared to Ruby Complicated OO Cryptic code (Ruby is often called “A Better Perl”) PS: Don’t kill me! Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 38
  • 39. Python compared to Ruby Incomplete OO Instance variables require self.var No class method No true GC (uses ref counting) Not suitable for one-liners PS: Don’t kill me! Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 39
  • 40. Resources Ruby Home Page http://www.ruby-lang.org/en/ Programming Ruby http://www.rubycentral.com/book/ RubyGarden http://www.rubygarden.org/ruby Ruby Application Archive (RAA) http://raa.ruby-lang.org/ Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 40
  • 41. Resources (contd.) RubyForge http://rubyforge.org/ ruby-talk http://blade.nagaokaut.ac.jp/ruby/ruby-talk Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 41
  • 42. If God did OOP, he’d probably do it in Python; He’s now considering switching to Ruby! Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 42
  • 43. Thank you! Questions? Ruby Talk - An Introduction to Ruby -- Linux Bangalore/2004 43