SlideShare a Scribd company logo
Let's Learn Ruby AQAP
As Quickly As Possible!
 Run the interactive ruby shell – irb
 Suggest using Netbeans – download ALL
2
2 + 6
22 / 4  5
Float(22)/4
22.0 / 4
3 * 3
3 ** 3
big_number = 1_000_000_000 (underscores not required
and can go anywhere allowed to make it more readable –
commas hard to see)
Simple Ruby Number Objects
3
Math.sqrt( 9 )
Math.methods
9.methods  will tell you what methods can be used with 9
27.class  will tell you what class 27 belongs to (Fixnum)
3.times { print "Ho! " }
1.upto( 5 ) { |i| puts i }  defines i as the iterator variable
termed a “code block”
Anonymous delegate given the name i
Ruby Number Methods
4
one = "1"
two = "2"
one + two  string concat, right?
Integer( one ) + Integer( two )  casts and then adds
12.to_s  calls to string method, but wants you to request
conversion
print "Happy ", 12.to_s, "th Birthday!"
puts "Happy ", 12.to_s, "th Birthday!"
puts "Happy " + 12 + "th Birthday!"
Number Conversions
5
a1 = "this is a stringn”  evaluate backslash and contents of
#{} inside of the string. Termed string interpolation
a2 = 'and so is thisn‘  will see the n as no evaluation is
done
print a1
print a2
answer = “joy”
puts "The meaning of life is #{answer}"
puts "There's #{24*60*60} seconds in a day"
Ruby String Objects
6
formatted_text = <<END_OF_TEXT
Let us turn our thoughts today
To Martin Luther King
And recognize that there are ties between us
All men and women
Living on the Earth
Ties of hope and love
Sister and brotherhood
That we are bound together
In our desire to see the world become
A place in which our children
Can grow free and strong
END_OF_TEXT  any delimiter – as long as it matches
print formatted_text  interpretation does work
Ruby Here Documents
7
String.methods.sort  sorted list of String methods
formatted_text.size  number of characters
formatted_text.downcase  lowercase
formatted_text.upcase  uppercase
formatted_text.capitalize!  ! means to actually change the
object in place (rather than return a changed copy)
formatted_text.reverse  reverses all characters
formatted_text.empty?  boolean indicated by ?
only used in method names (not variables)
Ruby String Methods
8
song_lines = formatted_text.to_a  to array
(1..10).to_a  [1,2,3,4,5,6,7,8,9,10] from a range
(denoted ..)
(‘a’..’e’).to_a  [“a”, “b”, “c”, “d”, “e”]
print song_lines[1]
print song_lines[5]
print song_lines[99]  Gives nil if used when out of range,
will add to array if assign outside of range.
print song_lines
print formatted_text
song_lines.class  Array
formatted_text.class  String
Working with Ruby Strings
9
Same variable can hold any type at different times…
a = 42
puts a
a = "The Ruby Programming Language"
puts a
a = 1.8
puts a
What About Variable Type?
10
 Everything - numbers, strings, data structures,
Class itself etc. - is an object
 Methods are invoked using the dot (".") notation
 Variables are dynamically created as needed
(problems with typos), but will tell you during
execution if you access something without a
value.
 The traditional notion of a variable's "type" is
not something the Ruby programmer concerns
themselves with (too much)
11

More Related Content

Viewers also liked

Atul Westernhills Phase II Brochure - Zricks.com
Atul Westernhills Phase II Brochure - Zricks.comAtul Westernhills Phase II Brochure - Zricks.com
Atul Westernhills Phase II Brochure - Zricks.com
Zricks.com
 
Casa Grande Padi Brochure - Zricks.com
Casa Grande Padi Brochure - Zricks.comCasa Grande Padi Brochure - Zricks.com
Casa Grande Padi Brochure - Zricks.com
Zricks.com
 
Shriram Southern Crest Brochure - Zricks.com
Shriram Southern Crest Brochure - Zricks.comShriram Southern Crest Brochure - Zricks.com
Shriram Southern Crest Brochure - Zricks.com
Zricks.com
 
Oberoi Commerz Brochure - Zricks.com
Oberoi Commerz Brochure - Zricks.comOberoi Commerz Brochure - Zricks.com
Oberoi Commerz Brochure - Zricks.com
Zricks.com
 
Paranjape Xion Brochure - Zricks.com
Paranjape Xion Brochure - Zricks.comParanjape Xion Brochure - Zricks.com
Paranjape Xion Brochure - Zricks.com
Zricks.com
 
Panvelkar Green City Brochure - Zricks.com
Panvelkar Green City Brochure - Zricks.comPanvelkar Green City Brochure - Zricks.com
Panvelkar Green City Brochure - Zricks.com
Zricks.com
 
Sterling Villa Grande Brochure - Zricks.com
Sterling Villa Grande Brochure - Zricks.comSterling Villa Grande Brochure - Zricks.com
Sterling Villa Grande Brochure - Zricks.com
Zricks.com
 
Assetz 27 Park Avenue Brochure - Zricks.com
Assetz 27 Park Avenue Brochure - Zricks.comAssetz 27 Park Avenue Brochure - Zricks.com
Assetz 27 Park Avenue Brochure - Zricks.com
Zricks.com
 
Mantra Divine Brochure - Zricks.com
Mantra Divine Brochure - Zricks.comMantra Divine Brochure - Zricks.com
Mantra Divine Brochure - Zricks.com
Zricks.com
 
Majestique Manhattan Brochure - Zricks.com
Majestique Manhattan Brochure - Zricks.comMajestique Manhattan Brochure - Zricks.com
Majestique Manhattan Brochure - Zricks.com
Zricks.com
 
Ekta Legranz Brochure - Zricks.com
Ekta Legranz Brochure - Zricks.comEkta Legranz Brochure - Zricks.com
Ekta Legranz Brochure - Zricks.com
Zricks.com
 
Arge Urban Bloom Brochure - Zricks.com
Arge Urban Bloom Brochure - Zricks.comArge Urban Bloom Brochure - Zricks.com
Arge Urban Bloom Brochure - Zricks.com
Zricks.com
 
Prestige Silver Crest Brochure - Zricks.com
Prestige Silver Crest Brochure - Zricks.comPrestige Silver Crest Brochure - Zricks.com
Prestige Silver Crest Brochure - Zricks.com
Zricks.com
 
Arge Helios Brochure - Zricks.com
Arge Helios Brochure - Zricks.comArge Helios Brochure - Zricks.com
Arge Helios Brochure - Zricks.com
Zricks.com
 

Viewers also liked (14)

Atul Westernhills Phase II Brochure - Zricks.com
Atul Westernhills Phase II Brochure - Zricks.comAtul Westernhills Phase II Brochure - Zricks.com
Atul Westernhills Phase II Brochure - Zricks.com
 
Casa Grande Padi Brochure - Zricks.com
Casa Grande Padi Brochure - Zricks.comCasa Grande Padi Brochure - Zricks.com
Casa Grande Padi Brochure - Zricks.com
 
Shriram Southern Crest Brochure - Zricks.com
Shriram Southern Crest Brochure - Zricks.comShriram Southern Crest Brochure - Zricks.com
Shriram Southern Crest Brochure - Zricks.com
 
Oberoi Commerz Brochure - Zricks.com
Oberoi Commerz Brochure - Zricks.comOberoi Commerz Brochure - Zricks.com
Oberoi Commerz Brochure - Zricks.com
 
Paranjape Xion Brochure - Zricks.com
Paranjape Xion Brochure - Zricks.comParanjape Xion Brochure - Zricks.com
Paranjape Xion Brochure - Zricks.com
 
Panvelkar Green City Brochure - Zricks.com
Panvelkar Green City Brochure - Zricks.comPanvelkar Green City Brochure - Zricks.com
Panvelkar Green City Brochure - Zricks.com
 
Sterling Villa Grande Brochure - Zricks.com
Sterling Villa Grande Brochure - Zricks.comSterling Villa Grande Brochure - Zricks.com
Sterling Villa Grande Brochure - Zricks.com
 
Assetz 27 Park Avenue Brochure - Zricks.com
Assetz 27 Park Avenue Brochure - Zricks.comAssetz 27 Park Avenue Brochure - Zricks.com
Assetz 27 Park Avenue Brochure - Zricks.com
 
Mantra Divine Brochure - Zricks.com
Mantra Divine Brochure - Zricks.comMantra Divine Brochure - Zricks.com
Mantra Divine Brochure - Zricks.com
 
Majestique Manhattan Brochure - Zricks.com
Majestique Manhattan Brochure - Zricks.comMajestique Manhattan Brochure - Zricks.com
Majestique Manhattan Brochure - Zricks.com
 
Ekta Legranz Brochure - Zricks.com
Ekta Legranz Brochure - Zricks.comEkta Legranz Brochure - Zricks.com
Ekta Legranz Brochure - Zricks.com
 
Arge Urban Bloom Brochure - Zricks.com
Arge Urban Bloom Brochure - Zricks.comArge Urban Bloom Brochure - Zricks.com
Arge Urban Bloom Brochure - Zricks.com
 
Prestige Silver Crest Brochure - Zricks.com
Prestige Silver Crest Brochure - Zricks.comPrestige Silver Crest Brochure - Zricks.com
Prestige Silver Crest Brochure - Zricks.com
 
Arge Helios Brochure - Zricks.com
Arge Helios Brochure - Zricks.comArge Helios Brochure - Zricks.com
Arge Helios Brochure - Zricks.com
 

Similar to Learn ruby intro

Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
ppparthpatel123
 
Ruby from zero to hero
Ruby from zero to heroRuby from zero to hero
Ruby from zero to hero
Diego Lemos
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objects
Harkamal Singh
 
Ruby_Basic
Ruby_BasicRuby_Basic
Ruby_Basic
Kushal Jangid
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love Game
Antony Stubbs
 
Ruby
RubyRuby
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
NagaLakshmi_N
 
Ruby basics
Ruby basicsRuby basics
Ruby basics
Tushar Pal
 
Ruby — An introduction
Ruby — An introductionRuby — An introduction
Ruby — An introduction
Gonçalo Silva
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
hishamrizvi
 
Regex lecture
Regex lectureRegex lecture
Regex lecture
Jun Shimizu
 
Ruby Programming
Ruby ProgrammingRuby Programming
Ruby Programming
Sadakathullah Appa College
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Raghu nath
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
Sujith Kumar
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
Mahzad Zahedi
 
Ruby
RubyRuby
Intro to Ruby/Rails at TechLady Hackathon
Intro to Ruby/Rails at TechLady HackathonIntro to Ruby/Rails at TechLady Hackathon
Intro to Ruby/Rails at TechLady Hackathon
kdmcclin
 

Similar to Learn ruby intro (20)

Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
 
Ruby from zero to hero
Ruby from zero to heroRuby from zero to hero
Ruby from zero to hero
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objects
 
Ruby_Basic
Ruby_BasicRuby_Basic
Ruby_Basic
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love Game
 
Ruby
RubyRuby
Ruby
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
 
Ruby basics
Ruby basicsRuby basics
Ruby basics
 
Ruby — An introduction
Ruby — An introductionRuby — An introduction
Ruby — An introduction
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
 
Regex lecture
Regex lectureRegex lecture
Regex lecture
 
Ruby Programming
Ruby ProgrammingRuby Programming
Ruby Programming
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Ruby
RubyRuby
Ruby
 
Intro to Ruby/Rails at TechLady Hackathon
Intro to Ruby/Rails at TechLady HackathonIntro to Ruby/Rails at TechLady Hackathon
Intro to Ruby/Rails at TechLady Hackathon
 

More from Young Alista

Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
Young Alista
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architectures
Young Alista
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserialization
Young Alista
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
Young Alista
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
Young Alista
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
Young Alista
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
Young Alista
 
Cache recap
Cache recapCache recap
Cache recap
Young Alista
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
Young Alista
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
Young Alista
 
Object model
Object modelObject model
Object model
Young Alista
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
Young Alista
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Young Alista
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
Young Alista
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Young Alista
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Young Alista
 
Abstract class
Abstract classAbstract class
Abstract class
Young Alista
 
Inheritance
InheritanceInheritance
Inheritance
Young Alista
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
Young Alista
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Young Alista
 

More from Young Alista (20)

Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architectures
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserialization
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
Cache recap
Cache recapCache recap
Cache recap
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Object model
Object modelObject model
Object model
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Abstract class
Abstract classAbstract class
Abstract class
 
Inheritance
InheritanceInheritance
Inheritance
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 

Recently uploaded

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 

Recently uploaded (20)

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 

Learn ruby intro

  • 1. Let's Learn Ruby AQAP As Quickly As Possible!
  • 2.  Run the interactive ruby shell – irb  Suggest using Netbeans – download ALL 2
  • 3. 2 + 6 22 / 4  5 Float(22)/4 22.0 / 4 3 * 3 3 ** 3 big_number = 1_000_000_000 (underscores not required and can go anywhere allowed to make it more readable – commas hard to see) Simple Ruby Number Objects 3
  • 4. Math.sqrt( 9 ) Math.methods 9.methods  will tell you what methods can be used with 9 27.class  will tell you what class 27 belongs to (Fixnum) 3.times { print "Ho! " } 1.upto( 5 ) { |i| puts i }  defines i as the iterator variable termed a “code block” Anonymous delegate given the name i Ruby Number Methods 4
  • 5. one = "1" two = "2" one + two  string concat, right? Integer( one ) + Integer( two )  casts and then adds 12.to_s  calls to string method, but wants you to request conversion print "Happy ", 12.to_s, "th Birthday!" puts "Happy ", 12.to_s, "th Birthday!" puts "Happy " + 12 + "th Birthday!" Number Conversions 5
  • 6. a1 = "this is a stringn”  evaluate backslash and contents of #{} inside of the string. Termed string interpolation a2 = 'and so is thisn‘  will see the n as no evaluation is done print a1 print a2 answer = “joy” puts "The meaning of life is #{answer}" puts "There's #{24*60*60} seconds in a day" Ruby String Objects 6
  • 7. formatted_text = <<END_OF_TEXT Let us turn our thoughts today To Martin Luther King And recognize that there are ties between us All men and women Living on the Earth Ties of hope and love Sister and brotherhood That we are bound together In our desire to see the world become A place in which our children Can grow free and strong END_OF_TEXT  any delimiter – as long as it matches print formatted_text  interpretation does work Ruby Here Documents 7
  • 8. String.methods.sort  sorted list of String methods formatted_text.size  number of characters formatted_text.downcase  lowercase formatted_text.upcase  uppercase formatted_text.capitalize!  ! means to actually change the object in place (rather than return a changed copy) formatted_text.reverse  reverses all characters formatted_text.empty?  boolean indicated by ? only used in method names (not variables) Ruby String Methods 8
  • 9. song_lines = formatted_text.to_a  to array (1..10).to_a  [1,2,3,4,5,6,7,8,9,10] from a range (denoted ..) (‘a’..’e’).to_a  [“a”, “b”, “c”, “d”, “e”] print song_lines[1] print song_lines[5] print song_lines[99]  Gives nil if used when out of range, will add to array if assign outside of range. print song_lines print formatted_text song_lines.class  Array formatted_text.class  String Working with Ruby Strings 9
  • 10. Same variable can hold any type at different times… a = 42 puts a a = "The Ruby Programming Language" puts a a = 1.8 puts a What About Variable Type? 10
  • 11.  Everything - numbers, strings, data structures, Class itself etc. - is an object  Methods are invoked using the dot (".") notation  Variables are dynamically created as needed (problems with typos), but will tell you during execution if you access something without a value.  The traditional notion of a variable's "type" is not something the Ruby programmer concerns themselves with (too much) 11

Editor's Notes

  1. What do you notice that seems more “object oriented” than other languages?