The the Ruby Workshop : Develop Powerful Applications by Writing Clean, Expressive Code with Ruby and Ruby on Rails.
Material type:
- text
- computer
- online resource
- 9781838648879
- 005.117
- QA76.73.R83 .P385 2019
Cover -- FM -- Copyright -- Table of Contents -- Preface -- Chapter 1: Writing and Running Ruby Programs -- Introduction -- Key Features of Ruby -- Object-Oriented -- Interpreted Language -- Duck Typing and Dynamic Typing -- Multi-paradigm Language -- Reflection -- Metaprogramming -- Interactive Ruby Shell (IRB) -- Exercise 1.01: Creating and Assigning Variables -- Exercise 1.02: Assigning a Variable of One Data Type to a Different Type -- Exercise 1.03: Getting the Type of a Variable -- Getting the Details of the Public Methods of an Object -- Running Ruby Code from Ruby Files -- Exercise 1.04: Getting User Input in a Ruby Program -- Standard Data Types -- Number -- Exercise 1.05: Performing Common Integer Operations -- Exercise 1.06: Using Common Integer Methods to Perform Complex Arithmetic -- Floating-Point Numbers -- Exercise 1.07: Performing Common Operations for Floating-Point Numbers -- String -- Exercise 1.08: Using Common String Methods -- Exercise 1.09: Performing String Concatenation -- Exercise 1.10: Performing String Interpolation -- Exercise 1.11: Extracting and Searching a Substring from a String -- Exercise 1.12: Replacing Part of a String with Another String -- Exercise 1.13: Replacing All the Values inside a String Using gsub -- Exercise 1.14: Splitting a String and Joining a String -- Activity 1.01: Generating Email Addresses Using Ruby -- Boolean -- Activity 1.02: Calculating the Area and Perimeter of a Candy Manufacturing Plant -- Summary -- Chapter 2: Ruby Data Types and Operations -- Introduction -- Arrays -- Iterating Through an Array -- Operations on Arrays -- Merging Two Arrays -- Removing Occurrences of Similar Elements from an Array -- Inserting Elements into an Array at the End -- Finding the Last Element of an Array without Modifying It -- Finding the Last Element of an Array and Removing it.
Exercise 2.01: Performing Simple Operations on Arrays -- Creating an Array That Cannot Be Modified -- Finding All the Unique Elements in an Array -- Sorting the Elements of an Array -- Finding the Number of Elements in an Array -- Establishing Whether an Element Exists in an Array (Case-Sensitive) -- Converting Elements of an Array into a String -- Exercise 2.02: Performing Complex Operations on Arrays -- Hashes -- Operations on Hashes -- Getting Values from the Hash -- Sorting a Hash -- Merging Hashes -- Retrieving Keys or Values from a Hash -- Deleting a Value from a Hash by Key -- Removing or Rejecting Elements from a Hash -- Establishing whether a Hash Contains a Particular Value -- Exercise 2.03: Converting a Time String to a Hash -- Ruby Methods -- Passing Arguments to a Method -- Ruby Methods with Default Values -- Return Value(s) from Methods -- Naming Conventions for Methods -- Activity 2.01: Dice Roller Program -- Summary -- Chapter 3: Program Flow -- Introduction -- Boolean Operators -- The AND Operator -- The OR Operator -- The NOT Operator -- Truth Tables -- Truthiness -- Precedence -- Exercise 3.01: Implementing Boolean Operators -- Conditional Expressions -- The if Statement -- The else Statement -- The elsif Statement -- The unless Statement -- Comparison -- Comparison Operators -- Comparing Strings -- Exercise 3.02: Creating a Method to Check Your Balance -- The case/when Statement -- The === Operator -- The Ternary Operator -- Exercise 3.03: Speed Determiner -- Loops -- The while/do Loop -- Exercise 3.04: Developing a Mind Reader -- The until/do Loop -- The do/while Loop -- Iterators and Enumerators -- The each Method -- The each_with_index Method -- The map/collect Loop -- Exercise 3.05: Developing an Arbitrary Math Method -- Activity 3.01: Number-Guessing Game -- Summary -- Chapter 4: Ruby Methods -- Introduction.
The Basic Structure of the Ruby Method -- Method Components: Signature and Implementation -- The Method Signature -- Method Arguments -- Positional Arguments -- Variable Scope -- Optional Parentheses and Code Style -- Mandatory and Optional Arguments -- Keyword Arguments -- Return Values -- Multiple Return Values -- Exercise 4.01: Performing Operations on an Array -- The Splat Operator -- The Single Splat (*) Operator -- The Double Splat (**) Operator -- Exercise 4.02: Creating a Method to Take Any Number of Parameters -- Duck Typing -- Sending a Message -- Using Built-In Modules: Time and Math -- Math -- Exercise 4.03: Using the Math Library to Perform Mathematical Operations -- Time -- Exercise 4.04: Performing Method Operations with the Time Module -- Activity 4.01: Blackjack Card Game -- Summary -- Chapter 5: Object-Oriented programming with Ruby -- Introduction -- Classes and Objects -- Instance Methods -- Getters and Setters -- Exercise 5.01: Modeling a Company's Organizational Chart Using Classes -- Class Methods -- Method 1: Calling a Method Directly on the Class -- Method 2: Using the self Keyword -- Class Variables -- Exercise 5.02: Generating URLs for Sharing Content on Social Platforms -- Inheritance -- The Inheritance of Methods -- The Inheritance of Variables -- Calling super -- The Different Ways to Call super -- Calling super without Arguments -- Calling super with Arguments -- Calling super with the Naked Splat Operator -- Exercise 5.03: Modelling a Class for Location Addresses -- Encapsulation -- Public Methods -- Private Methods -- Protected Methods -- Exercise 5.04: Demonstrate the Visibility Rules of Ruby Methods -- Bypassing Visibility -- A Quick Note about File Organization -- Activity 5.01: Voting Application for Employee of the Month -- Summary -- Chapter 6: Modules and Mixins -- Introduction -- Including Modules.
Exercise 6.01: Controlling the Operations of Services in an Application -- Inheritance with Module Methods -- Inclusion Ordering -- extend -- Exercise 6.02: Extending Your Modules with Class and Instance Methods -- Module Callbacks -- Exercise 6.03: Using Module Functions to Extend Classes -- Importing Modules as Class Methods using Extended -- Combining include and extend -- Enumerated Types -- Exercise 6.04: Writing a Module to Define Payment Methods for a Product Application -- Module Methods -- Namespaces -- Exercise 6.05: How to Reuse Constants with a Namespace -- prepend -- prepend with Subclasses -- Exercise 6.06: Prepending Modules to Classes -- Activity 6.01: Implementing Categories on the Voting Application Program -- Summary -- Chapter 7: Introduction to Ruby Gems -- Introduction -- RubyGems and the require Method -- gem search -- gem install -- gem dependency -- gem Versioning -- gem list -- Using Gems in Your Code -- Exercise 7.01: Installing and Using a Ruby Gem -- File I/O -- Creating Files -- Reading Files -- Using the File.read Method -- Using the File.open Method -- Using the File.foreach Method -- read versus open versus foreach -- Writing to Files -- Using the File.new Method (Initializer) -- Using the File.open Method with a Block Method -- Using the File.write Method -- File.open versus File.new -- File Modes -- File Helpers -- Handling CSV Data -- Reading Data from a CSV File Using CSV.read -- Using Column Headers as Field Names -- Exercise 7.02: Reading Data from a .csv File and Printing a Few Columns -- Reading Data from a .csv File Using CSV.foreach -- Response Type Variations -- Writing Data -- Writing CSV Data from an Enumerable -- Exercise 7.03: Writing an Array of Users to a CSV File -- Service Objects -- The Single Responsibility Principle -- Service Objects versus Modules -- Class Method Execution.
Exercise 7.04: Building a Service Object -- Activity 7.01: Presenting Voting Data in CSV Format Using Ruby Gems -- Summary -- Chapter 8: Debugging with Ruby -- Introduction -- Logging and Debugging -- Logging with the logger Class -- Basic Logging -- Log Levels -- Exercise 8.01: Logging User Information -- Exercise 8.02: Creating a Basic Exception Logger -- Setting Log Levels by String -- Log Output -- STDOUT -- STDERR -- File -- Log Formatting -- Custom Date Formats -- Custom String Formats -- Time Zones and UTC -- Log File Management -- Size-Based Retention -- Time-Based Retention -- Exercise 8.03: Creating a Rolling Log File -- Debugging -- Debugging Concepts -- Breakpoints -- Stack Trace/Call Stack/Back Trace -- Viewing the Stack Trace -- StepOver, StepInto, and StepOut -- Debugging via the CLI with byebug -- Conditional Debugging -- Navigating with byebug -- Exercise 8.04: Debugging with byebug -- Debugging with Visual Studio Code -- Setting Breakpoints -- Logpoints -- The Debug Console -- Exercise 8.05: Debugging with Visual Studio Code -- Activity 8.01: Perform Debugging on a Voting Application -- Summary -- Chapter 9: Ruby Beyond the Basics l -- Introduction -- Metaprogramming -- Blocks -- Syntax for Blocks -- With do/end -- With curly brackets ({}) -- yield with Blocks -- Exercise 9.01: Building a Simple Calculator -- block_given? with Blocks -- Exercise 9.02: Building a Flight Status Display System -- The proc Object -- Exercise 9.03: Performing the sum Function on a Range of Numbers -- Exercise 9.04: Calculating Profit Using proc on an Input Price List -- Lambdas -- Exercise 9.05: Creating a Program to Sum a Range of Numbers Using Lambdas -- proc versus lambda -- The Story of the Chef and the Restaurant -- Activity 9.01: Invoice Generator -- Summary -- Chapter 10: Ruby Beyond the Basics ll -- Introduction -- Metaprogramming - A Deep Dive.
Opening Classes.
The Ruby Workshop equips you with the real-world skills that you can apply to your own web application development projects. Whether you want to create a web application, write simple scripts, manipulate data, or just learn the basics of object-oriented programming, this book will quickly get you on the right track.
Description based on publisher supplied metadata and other sources.
Electronic reproduction. Ann Arbor, Michigan : ProQuest Ebook Central, 2024. Available via World Wide Web. Access may be limited to ProQuest Ebook Central affiliated libraries.
There are no comments on this title.