更新时间:2021-07-02 21:14:15
coverpage
Title Page
Credits
About the Author
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Introduction to the Ruby Programming Language
What is Ruby?
Popular sites that use Ruby
Installing Ruby on a computer
Ruby language dashboard
Installing different Ruby versions with RVM
Summary
Ruby Variables
Using variables in Ruby
Variable code implementation
Printing to the Ruby console
Using puts
Using p
Getting input from the Ruby console using gets and chomp
Code implementation
Variable scope and variable types
Local variables
Global variables
Instance variables
Constants
Class variables
Ruby Strings
Using strings in Ruby
Missing quotation marks
Printing strings
Storing strings in variables
String interpolation guide for Ruby
What is string interpolation?
String manipulation guide
What is string manipulation?
String manipulation code examples
Method chaining
A practical implementation
Give it a bang!
String substitution guide
Adding a bang
Becoming a block head
Split strip and join guides for strings
Using the strip method
Using the split method
Using the join method
Working with Numbers in Ruby
Integer arithmetic guide
Arithmetic order of operations
Difference between integers and floats
Ruby Methods
Creating methods in Ruby
What does a Ruby method return?
What are the differences between class and instance methods in Ruby?
Ruby proc tutorial
Proc code example
What is a block?
The Ruby lambda tutorial
Stabby lambdas
What is the difference between procs and lambdas in Ruby?
Argument count
Return behavior
Guide to method arguments in Ruby
What are method arguments?
Method argument syntax
Method argument code examples
Named arguments
Default argument values
Using splat and optional arguments in Ruby methods
Traditional splat arguments
Keyword-based splat arguments
Optional arguments
Ruby Iterators and Loops
The while loop guide
The while loop code example
The each iterator method tutorial
The each loop code example
The for...in loops tutorial
Looping over a hash
Nested iterator code example
Using the select method
Using the map method – part 1