Learn to Code with Ruby

Video description

Ruby is a language released by Yukihiro Matsumoto in 1995 that bills itself as “a programmer’s best friend”. Every aspect of Ruby is designed to make programming easier for the developer. There is no better first language if you are interested in learning how to program.

Ruby also serves as the foundation for Ruby on Rails, a popular web framework that powers over 1.2 million websites worldwide. The course offers an extensive introduction to the base language you will need to know if you intend to tackle web development in the future.

The course starts by introducing you to Ruby programming and helps you install Ruby on macOS and Windows OS. You will then look at common programming concepts (variables, arithmetic, output). You will learn objects and methods, strings, numbers, Booleans, methods and conditionals, ranges, arrays, and hashes. After that, you will look at Blocks, Procs, and Lambdas; dates and times; file input and output; and regular expressions. Finally, you will look at classes, modules, and inheritance in detail.

By the end of this course, you will be confident enough to work on the Ruby programming language and bring your programming experience to the next level.

What You Will Learn

  • Install and configure Ruby on both macOS and Windows systems
  • Learn vital programming concepts (variables, arithmetic, output)
  • Understand objects and methods, strings, numbers, and Booleans
  • Look at methods and conditionals, ranges, arrays, hashes, and blocks
  • Study about Procs, Lambdas, dates and times, file input and output
  • Get to know regular expressions, classes, modules, and inheritance


This course is best suited for the beginning programmers who want to start with an easy, human-friendly language, intermediate coders who are interested in exploring the Ruby language in greater depth, and web development folk curious about the foundation of Ruby on Rails.

Basic text editing skills along with computer skills (web browsing, app installation, file navigation) would be highly recommended to get the most out of this course.

About The Author

Boris Paskhaver: Boris Paskhaver is a NYC-based web developer and software engineer with experience in building apps in React/Redux and Ruby on Rails. Raised in New Jersey, he graduated from the Stern School of Business at New York University in 2013 with a double major in business economics and marketing. Since graduation, his work has taken him in a wide variety of directions—he spent years in marketing, then financial services, and now the tech industry.

He has worked everywhere, from a 50-person digital agency to an international tech powerhouse with thousands of employees. He always had a love of learning but struggled with the traditional resources available for education. His goal is to create comprehensive courses that break down complex details into small, digestible pieces.

Publisher resources

Download Example Code

Table of contents

  1. Chapter 1 : Introduction and Installation
    1. Introduction to Ruby
    2. MacOS - Access and Work with the Terminal
    3. MacOS - Install Homebrew, rbenv, and Ruby
    4. MacOS - Download Atom Text Editor
    5. MacOS - Install atom-runner Package and Visual Theme
    6. MacOS - Write the First Ruby File and Run with Atom Runner
    7. MacOS - Run Ruby File from Terminal
    8. Windows - Download and Install Ruby
    9. Windows - Download Atom Text Editor
    10. Windows - Install atom-runner Package and Custom Theme
    11. Windows - Write the First Ruby File and Run with Atom Runner
    12. Windows - Run Ruby File from Command Prompt
    13. Interactive Ruby (IRB)
  2. Chapter 2 : Getting Started
    1. The puts Method
    2. The print Method
    3. The p Method
    4. Basic Arithmetic in Ruby
    6. Variables
    7. Parallel Variable Assignment and Swapping Variable Values
    8. Constants
    9. Introduction to Object Methods
    10. Return Values and the nil Object
    11. String Interpolation
    12. The gets Method and the chomp Method
  3. Chapter 3 : Numbers and Booleans
    1. Introduction to Numbers and the .class Method
    2. Convert Numbers to Strings and Vice Versa
    3. Introduction to Booleans
    4. The .odd? and .even? Predicate Methods
    5. Comparison with the Equality (==) Operator
    6. Comparison with the Inequality (!=) Operator
    7. Less Than and Greater Than Operators
    8. Arithmetic Methods and Basic Arguments
    9. Introduction to Object Methods with Parameters (The .between? Predicate Method)
    10. Float Methods
    11. Assignment Operators
    12. Introduction to Blocks with the .times Method
    13. The .upto and .downto Methods
    14. BONUS - The .step Method
  4. Chapter 4 : Strings I
    1. Create a String
    2. Multiline Strings
    3. Escape Characters
    4. Single Quotes Versus Double Quotes
    5. Equality and Inequality Operators with Strings
    6. Concatenate Strings
    7. The .length and .size Methods
    8. Extract Single Characters from String with Bracket Syntax
    9. Extract Multiple Characters from String with Bracket Syntax
    10. Extract Multiple Characters with Range Objects
    11. Overwrite Characters in String with Bracket Syntax
    12. Case Methods
    13. The .reverse Method on a String
    14. Bang Methods on Strings
    15. The .include? Method on a String
    16. The .empty? and .nil? Methods on a String
  5. Chapter 5 : Methods and Conditionals I
    1. Introduction to Methods
    2. Local Variables
    3. Parameters and Arguments
    4. Return Values I
    5. Return Values II - Default Return Values and the Return of the puts Method
    6. The if Statement
    7. Truthiness and Falseness
    8. if elsif
    9. The else Keyword
    10. Multiple Conditions with Operator
    11. Multiple Conditions with || Operator
    12. Parentheses and Precedence
    13. Nested if Statements
    14. The .respond_to? Method
    15. Ternary Operator
    16. Default or Optional Parameters
    17. Call A Method from Another Method or Interpolated String
  6. Chapter 6 : Methods and Conditionals II
    1. The case Statement
    2. Negation with !
    3. The unless Keyword
    4. The while Keyword
    5. The until Keyword
    6. CHALLENGE: FizzBuzz
    7. Statement Modifiers / Inline Modifiers
    8. Conditional Assignment
  7. Chapter 7 : Ranges
    1. Introduction to Ranges
    2. Alphabetical Ranges
    3. The .size Method on a Range
    4. Check if Value Exists in a Range with .includes? Method or ===
    5. Generate A Random Number with the rand Method
  8. Chapter 8 : Arrays I - Creation, Addition, and Modification
    1. Introduction to Arrays
    2. Create An Array with Bracket Syntax
    3. Shorthand %w Syntax to Create an Array of Strings
    4. Create an Array with Array.new Method
    5. Access Single Array Element by Index Position
    6. Access Single Array Element with .fetch Method
    7. Extract Sequential Array Elements with Bracket Syntax
    8. Access Sequential Array Elements with a Range Object
    9. Access Multiple Array Elements with the .values_at Method
    10. The .slice Method
    11. Overwrite One or More Array Elements
    12. The .length, .size and .count Methods on an Array
    13. The .empty? and .nil? Methods on an Array
    14. The .first and .last Methods
    15. The .push Method, the Shovel Operator, and the .insert Method
    16. The .pop Method
    17. The .shift and .unshift Methods
    18. Equality and Inequality Operators with Arrays
    19. The Spaceship Operator
    20. Convert Ranges to Arrays with the .to_a Method
    21. The .is_a? Predicate Method
  9. Chapter 9 : Arrays II - Iteration and Various Methods
    1. The ri Program
    2. Review of Blocks
    3. The .each Method on an Array
    4. More Practice with the .each Method
    5. Each within each
    6. The For Loop
    7. The .each_with_index Method
    8. Challenge: The .each_with_index Method
    9. The .map and .collect Methods on an Array
    10. Iteration over Array with While or Until Loops
    11. The break Keyword
    12. The next Keyword
    13. The .reverse Method on an Array
    14. The .sort Method on an Array
    15. The .concat Method on an Array
    16. The .max and .min Methods on an Array
    17. The .include? Predicate Method on an Array
    18. The .index and .find_index Methods on an Array
    19. The .select Method on an Array
    20. The .reject Method on an Array
    21. Unpack a Multidimensional Array
    22. The .partition Method on an Array
  10. Chapter 10 : Strings II
    1. The .split Method on a String
    2. Iterate over String Characters
    3. The .join Method on an Array
    4. The .count Method on a String
    5. The .index and .rindex Methods on a String
    6. The .insert Method on a String
    7. The .squeeze Method
    8. The .clear Method on a String
    9. The .delete Method on a String
  11. Chapter 11 : Arrays III - Bonus Methods
    1. Object Pointers and Object Copies
    2. Splat Arguments
    3. The .any? And .all? Methods on an Array
    4. The .find and .detect Methods on an Array
    5. The .uniq Method on an Array
    6. The .compact Method on an Array
    7. The .inject and .reduce Methods on an Array
    8. The .flatten Method on an Array
    9. The .zip Method on an Array
    10. The .sample Method on an Array
    11. Multiply an Array with Asterisk Symbol
    12. Union - Combine Arrays and Exclude Duplicates
    13. Remove Array Items that Exist in another Array
    14. Array Intersection with the Ampersand Symbol
  12. Chapter 12 : Hashes I
    1. Introduction to Hashes
    2. Create Hash and Extract Values from Hashes by their Keys
    3. Introduction to Symbols and Symbols as Hash Keys
    4. Convert Symbols to Strings and Vice Versa
    5. The .fetch Method on a Hash
    6. Add a Key Value Pair to a Hash with Bracket Syntax or the .store Method
    7. The .length and .empty? Methods on a Hash
    8. The .each Method on a Hash
    9. The .each_key and .each_value Methods
    10. Retrieve Keys or Values from Hash as an Array
  13. Chapter 13 : Hashes II
    1. Create Hash with Default Value
    2. Convert Hash to Array and Vice Versa
    3. The .sort and .sort_by Methods on a Hash
    4. The .key? And .value? Methods on a Hash
    5. Hashes as Method Arguments
    6. The .delete Method on a Hash
    7. The .select and .reject Methods on a Hash
    8. The .merge Method to Combine Hashes
    9. CHALLENGE: Word Frequency in a Sentence String
  14. Chapter 14 : Blocks, Procs, and Lambdas
    1. Introduction to Blocks
    2. The yield Keyword
    3. Procs I
    4. The .block_given? Method
    5. Yielding with Arguments
    6. A Custom .each Method
    7. Procs II
    8. Pass a Ruby Method as Proc
    9. Methods with Proc Parameters
    10. Introduction to Lambdas
    11. Lambda Efficiency Example
  15. Chapter 15 : The Time Object
    1. Introduction to the Time Object
    2. Instance Methods on a Time Object
    3. Predicate Methods on Time Objects
    4. Add or Subtract Time by Seconds
    5. The Comparable Methods on a Time Object
    6. Convert Time Object to Other Objects
    7. Convert Time Object to Formatted String
    8. The .parse and .strptime Methods
  16. Chapter 16 : File Input and Output
    1. Read from a Text File with Ruby
    2. Write to a Text File with Ruby
    3. Rename and Delete a File with Ruby
    4. Command Line Arguments (ARGV)
    5. The load Method
    6. The require and require_relative Methods
  17. Chapter 17 : Regular Expressions
    1. The .start_with? and .end_with? Methods
    2. The .include? Method
    3. Introduction to Regular Expressions
    4. The .scan Method I
    5. The .scan Method II
    6. The Wildcard Symbol
    7. The Backslash
    8. RegEx Anchors
    9. Exclude Characters
    10. The .sub and .gsub Methods with Regular Expressions
    11. Rubular.com
  18. Chapter 18 : Classes I
    1. Introduction to Classes
    2. Review of the .class Method on Ruby Objects
    3. The .superclass and .ancestors Methods on a Class
    4. The .methods Method
    5. Create a Class
    6. Object Aliases
    7. Instance Variables and the .initialize Method
    8. Instance Methods
    9. Override the .to_s Method
    10. The Self-Keyword in an Instance Method
    11. Getter Methods
    12. Setter Methods
    13. Shortcut Accessor Methods
    14. Add Parameters to initialize Method
  19. Chapter 19 : Modules and Mixins
    1. Introduction to Modules
    2. Modules with Identical Methods
    3. Import Modules into the Current File
    4. The Math Module
    5. Mixins I - The Comparable Module
    6. Mixins II - Custom Mixins
    7. The .ancestors Method In-Depth
    8. The prepend Keyword
    9. The extend Keyword
    10. Mixins III - The Enumerable Module
  20. Chapter 20 : Classes II
    1. Private Methods
    2. Protected Methods
    3. Add Validation to Setter Methods
    4. Prefer Instance Methods to Instance Variables
    5. Calling Multiple Setter Methods within one Method
    6. Structs
    7. Monkey Patching I
    8. Monkey Patching II
    9. Monkey Patching III
    10. Class Variables and Class Methods
  21. Chapter 21 : Classes III
    1. Review of Inheritance
    2. Create Subclasses
    3. Check Inheritance Hierarchy
    4. The .is_a? and .instance_of? Predicate Methods
    5. Exclusive Instance Methods in Subclasses
    6. Override Methods in a Subclass
    7. The super Keyword I
    8. The super Keyword II
    9. Class Variables across Subclasses
    10. Singleton Classes and Singleton Methods
    11. Hash as initialize Argument I
    12. Hash as Initialize Argument II
  22. Chapter 22 : Reading and Writing Documentation
    1. Introduction to Rubydoc Documentation
    2. Class Method Documentation on RubyDocs
    3. Use rdoc to Generate Your Own Documentation I
    4. Use rdoc to Generate Your Own Documentation II
  23. Chapter 23 : Conclusion
    1. Conclusion

Product information

  • Title: Learn to Code with Ruby
  • Author(s): Boris Paskhaver
  • Release date: November 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781788834063