SlideShare a Scribd company logo
Ruby
Programming == Joy
Krupa Suthar
Why named ‘Ruby’?
● Influenced by majorly - Perl
● July Birthstone
Idea behind Ruby
● Yukihiro Matsumoto(‘Matz’) and a colleague were discussing of creating language
with more scripting power than Perl and more object-oriented than Python
● Born in 1993
● Features
○ Truly Object-Oriented
○ Portable
○ Garbage Collector
○ Exception handling
○ Syntactically simple
Get started with Ruby
● Version Manager - rbenv, rvm
● Install
● Irb - Interactive Ruby shell
Is this Object?
Is this Object?
Everything is OBJECT
● Including their properties and actions
● Everything has value, even if that value is nil
● No difference between an expression and statement
● =, .. , &&, ||, or, ::
Ruby
Ruby’s Flexibility
● Allow user to freely alter its parts
● No restrictions
● Open classes
● Ability to change any inbuilt methods
● Ability to change core classes like Fixnum
Ruby
Blocks - Truly expressive
● Add closure to method and closure will tell method how to act
● Invoke with yield
● block_given?
● Block with variables
Ruby
Ruby and Mixin
● Ruby does not support multiple inheritance
● Mixins allows to achieve by requiring multiple modules
● Modules - Collection of methods, constants, other module and class definitions
● Class can access modules by requiring
Ruby
Ruby’s visual appearance
● Code readable like story
● Simple naming conventions
○ snake_case - Method name
○ CamelCase - Class name
○ @var - Instance variable
○ var - Local variable
○ $var - Global variable
Things you need to know about Ruby
nil and false
● Everything except nil and false is considered true
● In Java and some other languages, 0 and possibly other values such as empty list,
are considered false
Access Modifiers
● Modifiers
● Scopes
Expressive method names
● Methods answering question return with Question mark (?)
E.g. Array#empty?
● ‘Dangerous’ methods end with Exclamation mark (!)
E.g. save!
Singleton methods
● Per-object methods. They are only available on the Object you defined it on.
Ruby
Message passing, not function calls
● A method call is really a message to another object
Keyword arguments
● Like Python, Ruby also allows to use keyword as argument
Missing methods
● missing_method error
● NameError
Ruby
RubyGems
● What are Gems?
● Installing Gem
● Bundler
● Using Gems
Thank You !
Any Questions??

More Related Content

PDF
HelsinkiJS - Clojurescript for Javascript Developers
PPTX
Groovy / comparison with java
PDF
Ruby on Rails: a brief introduction
PDF
Ruby - a pure object oriented language
PDF
Concurrency patterns in Ruby
PDF
Jade
PPTX
Introduction to JavaScript
PDF
Javascript for Intermediates
HelsinkiJS - Clojurescript for Javascript Developers
Groovy / comparison with java
Ruby on Rails: a brief introduction
Ruby - a pure object oriented language
Concurrency patterns in Ruby
Jade
Introduction to JavaScript
Javascript for Intermediates

What's hot (20)

PPTX
Practical domain driven design
PPTX
java - oop's in depth journey
PPTX
Protocol buffers
PPTX
Kotlin programming language
PDF
Intro to Ruby on Rails
PPTX
Introduction to Web Development - JavaScript
PDF
Head First Java Chapter 2
ODP
Constructors, Intro to Ruby Classes Part II
ODP
Intro Ruby Classes Part I
DOC
Typescript Basics
PDF
Introdução à Elixir
PDF
TDC2016SP - Groovy como você nunca viu
KEY
Top 10+ Things .NET Developers Should Know About Ruby
PDF
TypeScript - An Introduction
ODP
Getting Groovy
PPTX
Typescript
PPTX
Ts. what and why
PPT
Intro To Ror
PPT
Learning typescript
PDF
Getting Started with TypeScript
Practical domain driven design
java - oop's in depth journey
Protocol buffers
Kotlin programming language
Intro to Ruby on Rails
Introduction to Web Development - JavaScript
Head First Java Chapter 2
Constructors, Intro to Ruby Classes Part II
Intro Ruby Classes Part I
Typescript Basics
Introdução à Elixir
TDC2016SP - Groovy como você nunca viu
Top 10+ Things .NET Developers Should Know About Ruby
TypeScript - An Introduction
Getting Groovy
Typescript
Ts. what and why
Intro To Ror
Learning typescript
Getting Started with TypeScript
Ad

Similar to Ruby (20)

PDF
A Shallow Survey of Alternative Languages on the JVM
PDF
JavaScript: Patterns, Part 3
PDF
Introduction to JavaScript for Modern Software Development
PDF
Scala days mizushima
PDF
Concurrency patterns in Ruby
PPTX
Object oriented programming in java
PDF
JavaScript objects and functions
PDF
July 2012 Ruby Tuesday - Lana Lodge - Refactoring Lighting Talk
PDF
Devoxx%202008%20Tutorial
PDF
Devoxx%202008%20Tutorial
PDF
Ruby Presentation
PPTX
Comparing Golang and understanding Java Value Types
PDF
Core Java Introduction | Basics
PDF
Object Oriented Programming
PDF
OOP concepts with respected with Python
PPTX
Intro to java 8
PPTX
An introduction to Object Oriented JavaScript
PDF
Object Oriented Design and Concepts related to Object Oriented Programming
PPTX
Ruby for .NET developers
PDF
Ruby training day1
A Shallow Survey of Alternative Languages on the JVM
JavaScript: Patterns, Part 3
Introduction to JavaScript for Modern Software Development
Scala days mizushima
Concurrency patterns in Ruby
Object oriented programming in java
JavaScript objects and functions
July 2012 Ruby Tuesday - Lana Lodge - Refactoring Lighting Talk
Devoxx%202008%20Tutorial
Devoxx%202008%20Tutorial
Ruby Presentation
Comparing Golang and understanding Java Value Types
Core Java Introduction | Basics
Object Oriented Programming
OOP concepts with respected with Python
Intro to java 8
An introduction to Object Oriented JavaScript
Object Oriented Design and Concepts related to Object Oriented Programming
Ruby for .NET developers
Ruby training day1
Ad

Recently uploaded (20)

PPTX
1. Introduction to Computer Programming.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
A Presentation on Artificial Intelligence
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Getting Started with Data Integration: FME Form 101
PPT
Teaching material agriculture food technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
1. Introduction to Computer Programming.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A comparative analysis of optical character recognition models for extracting...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
cloud_computing_Infrastucture_as_cloud_p
Spectral efficient network and resource selection model in 5G networks
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Getting Started with Data Integration: FME Form 101
Teaching material agriculture food technology
Assigned Numbers - 2025 - Bluetooth® Document
Univ-Connecticut-ChatGPT-Presentaion.pdf
OMC Textile Division Presentation 2021.pptx

Ruby

  • 2. Why named ‘Ruby’? ● Influenced by majorly - Perl ● July Birthstone
  • 3. Idea behind Ruby ● Yukihiro Matsumoto(‘Matz’) and a colleague were discussing of creating language with more scripting power than Perl and more object-oriented than Python ● Born in 1993 ● Features ○ Truly Object-Oriented ○ Portable ○ Garbage Collector ○ Exception handling ○ Syntactically simple
  • 4. Get started with Ruby ● Version Manager - rbenv, rvm ● Install ● Irb - Interactive Ruby shell
  • 7. Everything is OBJECT ● Including their properties and actions ● Everything has value, even if that value is nil ● No difference between an expression and statement ● =, .. , &&, ||, or, ::
  • 9. Ruby’s Flexibility ● Allow user to freely alter its parts ● No restrictions ● Open classes ● Ability to change any inbuilt methods ● Ability to change core classes like Fixnum
  • 11. Blocks - Truly expressive ● Add closure to method and closure will tell method how to act ● Invoke with yield ● block_given? ● Block with variables
  • 13. Ruby and Mixin ● Ruby does not support multiple inheritance ● Mixins allows to achieve by requiring multiple modules ● Modules - Collection of methods, constants, other module and class definitions ● Class can access modules by requiring
  • 15. Ruby’s visual appearance ● Code readable like story ● Simple naming conventions ○ snake_case - Method name ○ CamelCase - Class name ○ @var - Instance variable ○ var - Local variable ○ $var - Global variable
  • 16. Things you need to know about Ruby nil and false ● Everything except nil and false is considered true ● In Java and some other languages, 0 and possibly other values such as empty list, are considered false Access Modifiers ● Modifiers ● Scopes
  • 17. Expressive method names ● Methods answering question return with Question mark (?) E.g. Array#empty? ● ‘Dangerous’ methods end with Exclamation mark (!) E.g. save! Singleton methods ● Per-object methods. They are only available on the Object you defined it on.
  • 19. Message passing, not function calls ● A method call is really a message to another object Keyword arguments ● Like Python, Ruby also allows to use keyword as argument Missing methods ● missing_method error ● NameError
  • 21. RubyGems ● What are Gems? ● Installing Gem ● Bundler ● Using Gems
  • 22. Thank You ! Any Questions??