A note on the digital index A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.
Symbols ! (exclamation mark) != (not equal to) operator, Conditionals in naming methods, Method names " (double quotes), Your first Ruby expressions (see also ' (single quotes)) #{...} notation inside, String interpolation , Ruby makes working with strings easy in double-quoted string, Escape sequences in strings specifying strings using, Your first Ruby expressions # (hash) mark at start of method names in documentation, Instance methods denoted with # in the docs making comments using, Running scripts % (percent) sign, format sequences, Format sequences & (ampersand), denoting block parameter to method, Defining a method that takes blocks , Your Ruby Toolbox && (and) operator, Conditionals ' (single quotes), Your first Ruby expressions (see also " (double quotes)) specifying strings using, Your first Ruby expressions ( ) parentheses using with parameters, Defining methods with method calls, Method arguments * (asterisk), multiplication operator, Your first Ruby expressions , “/” is a method ** (exponentiation) operator, Your first Ruby expressions + (plus) sign += operator, Variables addition operator, Your first Ruby expressions , “/” is a method for concatenation, Converting to strings , (commas) joining strings with, A program we should have had automated tests for separating arguments by, Method arguments separating array elements, Arrays separating parameters by, Method names , Block parameters - (minus sign), subtraction operator, Your first Ruby expressions , “/” is a method . (dot) denoting class methods in documentation, Looking up class methods Float vs. Fixnum literals, Division with Ruby’s Fixnum class operator, calling methods using, Everything is an object! , Running scripts , Calling methods you’ve defined , Call other methods on the same instance with “self” / (forward slash) denoting regular expression literals, #5 Regular expressions division operator, Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method in Sinatra route paths, Named parameters in Sinatra routes / (slash) denoting regular expression literals, #5 Regular expressions division operator, Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method in Sinatra route paths, Named parameters in Sinatra routes : (colon) denoting Sinatra named parameter, Named parameters in Sinatra routes replacing hash rocket (=>) with, Leave off the braces! symbol references using, Attribute writers and readers : : (double colon) scope resolution operator, marking class methods, Looking up class methods , The “initialize” instance method appears as the “new” class method : : (scope resolution) operator, marking class methods in documentation, Looking up class methods , The “initialize” instance method appears as the “new” class method ; (semicolon), using to separate statements, String interpolation < % %> (ERB regular embedding tag), The regular embedding tag < %= %> (ERB output embedding tag), The ERB output embedding tag , Pool Puzzle Solution , Building HTML links to individual movies (continued) , An ERB template for an individual movie < (less than) sign as method, A preview of the Comparable mixin , How the Comparable methods work comparison operator, Your first Ruby expressions indicating inheritance, Defining a subclass (is really easy) < < operator, inserting elements into arrays using, Arrays are objects, too! < = (less than or equal to operator), Conditionals as method, Mixins built into Ruby , How the Comparable methods work < => (spaceship operator) about, The spaceship operator implementing as method, Implementing the spaceship operator on Steak , Your Ruby Toolbox = (equals) sign assigning variables using, Variables in naming methods, Method names = = (equality) operator, Your first Ruby expressions , A preview of the Comparable mixin , How the Comparable methods work => (hash rocket), Leave off the braces! => in rescue clause, Exception messages > (greater than) sign as method, A preview of the Comparable mixin , How the Comparable methods work calling as method, Choice (of) beef comparison operator, Your first Ruby expressions >= (greater than or equal to operator), Conditionals as method, A preview of the Comparable mixin , How the Comparable methods work ? (question mark), in naming methods, Method names , The verbose way to find array elements, using “each” [ ] square brackets accessing arrays with, Accessing arrays accessing hashes with, Hashes , Returning something other than “nil” by default denoting array literals, Arrays in arguments in documentation, Arguments in call signatures (backslash), in escape sequences, Escape sequences in strings \ (double backslashes), Escape sequences in strings { } curly braces denoting blocks, Block formats hash literals, Hashes , Returning something other than “nil” by default , Leave off the braces! using for string interpolation, String interpolation | (vertical bars), denoting block parameters, Block parameters | | (or) operator, Conditionals , Using the Boolean “or” operator for assignment , Your Ruby Toolbox , Finding the next available movie ID A < a> HTML tag, Making a movie list in HTML , Building HTML links to individual movies (continued) abs method, Mixins built into Ruby accessor methods, Attribute accessor methods (see also attribute reader methods; attribute writer methods) about, Attribute accessor methods as type of instance method, Attribute writers and readers in action calling, Using accessor methods ensuring data is valid with, Ensuring data is valid with accessors action attribute, HTML form, Setting the HTML form to send a POST request , Your Ruby Toolbox addition operator (+), Your first Ruby expressions , “/” is a method add_comment method about, The media-sharing app creating mixins for comments, Creating a mixin for comments initialize method and revised, Why you shouldn’t add “initialize” to a mixin initializing instance variable within, Avoid using “initialize” methods in modules looking at revised, Using our comments mixin using comments mixin, Using our comments mixin conditional assignment operator with, The conditional assignment operator inheritance, The media-sharing app...using inheritance :age symbol, Attribute writers and readers age= method, Ensuring data is valid with accessors aliasing about, Aliasing problems with, Problems with a hash default object ampersand (&), denoting block parameter to method, Defining a method that takes blocks , Your Ruby Toolbox ancestors class method, Mixins and method overriding , Your Ruby Toolbox and (&&) operator, Conditionals and keyword, joining items with, A program we should have had automated tests for , Getting the test to pass apps, web browsers and, Browsers, requests, servers, and responses complete code for, Our complete app code defining routes, Sinatra routes , Multiple routes in the same Sinatra app displaying data accessing instance variables, Embedding a movie title in our HTML ERB embedding tags, ERB embedding tags output from embedding tags, The ERB output embedding tag using output embedding tag ( < %= %>), The ERB output embedding tag , Pool Puzzle Solution using regular embedding tag ( < % %>), The regular embedding tag handling requests serving HTML, Accessing the HTML from Sinatra setting up routes, Multiple routes in the same Sinatra app installing Sinatra, Installing the Sinatra gem planning, Writing web apps in Ruby , Saving and retrieving form data POST requests about, Saving and retrieving form data converting objects to and from strings, Converting objects to and from strings with YAML displaying objects, An ERB template for an individual movie finding objects in YAML::Store, A system for finding Movies in the YAML::Store finding objects within files, Building HTML links to individual movies loading objects, Loading all movies from the MovieStore managing YAML::Store, A class to manage our YAML::Store posting requests, Our browser can GET the form... saving objects to YAML::Store, Saving objects to a file with YAML::Store setting form attributes, Setting the HTML form to send a POST request testing YAML::Store, Testing the MovieStore resource path of, Resource path sending request to WEBrick library, Your computer is talking to itself setting up, Project directory structure setting up data with HTML forms, Letting users add data with HTML forms with HTML tables, Letting users add data with HTML forms arguments documentation, Arguments in call signatures optional arguments, Optional parameters parameters vs., Optional parameters to method calls, Defining methods ARGV array, #4 Command-line arguments Array class documentation, Read the docs for the superclass and mixins, too! (continued) array index, Accessing arrays arrays about, Arrays and Blocks: Better Than Loops accessing, Accessing arrays ARGV, #4 Command-line arguments arrays of arrays, An array of arrays...is not ideal as objects, Arrays are objects, too! converting strings to arrays, Arrays are objects, too! each method, The “each” method , Using “each” with the “refund” method Enumerable module and, The Enumerable module find_index instance method, Finding the index of an array element hashes vs., Hashes , Hashes and “each” , Your Ruby Toolbox inserting elements into, Arrays are objects, too! integer index in, Accessing arrays length of, Arrays are objects, too! making array based on another, Making one array that’s based on another, the hard way making hash of, Hash default blocks: A shortcut pop method, Arrays are objects, too! processing with while loops, Looping over the items in an array searching for values within, Arrays are objects, too! similarities between hashes and, Hashes assert method, MiniTest: Ruby’s standard unit-testing library , Tests for ListWithCommas , Test failure messages , Your Ruby Toolbox assert_equal method, A better way to assert that two values are equal assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods assignment statements assigning variables using equals (=) sign, Variables return value of, Hashes are objects using conditional assignment operator, The conditional assignment operator asterisk (*), multiplication operator, Your first Ruby expressions , “/” is a method attribute accessor methods defining via attr_accessor, Attribute writers and readers matching instance variable names, Instance variables belong to the object, not the class! subclasses inheriting, Inheritance to the rescue! using, Attribute writers and readers in action attribute reader methods about, Attribute accessor methods defining, Ensuring data is valid with accessors , When “self” is optional defining via attr_reader, Attribute writers and readers naming, Using accessor methods using, Attribute writers and readers in action attribute writer methods about, Attribute accessor methods calling, Attribute accessor methods , Call other methods on the same instance with “self” , When “self” is optional defining, Ensuring data is valid with accessors defining via attr_writer, Attribute writers and readers naming, Using accessor methods using, Attribute writers and readers in action validation and, Ensuring data is valid with accessors attribute, definition of, Attribute accessor methods automated testing about, Automated tests find your bugs before someone else does asserting two values are equal, A better way to assert that two values are equal MiniTest in about, Unit Testing: Code Quality Assurance , MiniTest: Ruby’s standard unit-testing library asserting two values are equal, A better way to assert that two values are equal assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods examining code, A closer look at the test code , Your Ruby Toolbox running tests, Running a test setup method, The “setup” method testing classes, Testing a class need for, A program we should have had automated tests for red, green, refactor cycle and, A closer look at the test code , Tests for ListWithCommas removing duplicated code from, Removing duplicated code from your tests B backslash (), in escape sequences, Escape sequences in strings between? method, A preview of the Comparable mixin , How the Comparable methods work Black, David A., The Well-Grounded Rubyist (2nd edition), #9 Bundler blocks about, Arrays and Blocks: Better Than Loops , Blocks accessing during method call, Blocks and variable scope , Your Ruby Toolbox adding rescue clause to begin/end, Ruby’s search for a rescue clause , Multiple rescue clauses in one begin/end block building arrays based on return value in, Making one array based on another, using “map” creating, Your first block declaring &block parameter, Using the “yield” keyword each method with about, The “each” method getting rid of repeated code, DRYing up our code with “each” and blocks using, The “each” method, step-by-step , The verbose way to find array elements, using “each” finding array elements using, Finding array elements we want, with a block find_all method passing array elements, Introducing a faster method... , How the method uses a block return value , Your Ruby Toolbox passing words, Mixing Enumerable into our class formats for curly brace { }, Block formats do...end, Your first block , Block formats hash default about, Our wish list for hash defaults assigning to hash, Hash default blocks: Assigning to the hash block return value, Hash default blocks: Block return value hash default objects vs., Using hash default objects safely matching values assigned to hash, Hash default blocks: Block return value rules for using, The rule of thumb for hash defaults in documentation, Blocks in call signatures include? method in, The verbose way to find array elements, using “each” map method passing array elements into blocks, Making one array that’s based on another, the hard way passing words, Mixing Enumerable into our class methods associating with, Block formats calling block multiple times, Calling a block multiple times defining methods that take blocks, Defining a method that takes blocks flow of control between blocks and, Flow of control between a method and block passing many blocks into single method, Calling the same method with different blocks similarities with, Blocks have a return value parameters in, Block parameters , Blocks have a return value , A closer look at the block return values , The return values for “reject” passing hashes to, Hashes and “each” processing files using, Safely closing the file, with a block reject method passing array elements, Eliminating elements we don’t want, with a block passing words, Mixing Enumerable into our class return keyword within, Blocks have a return value return values about, Blocks have a return value complete code for, The finished product finding index of array element, Finding the index of an array element find_all method with, Putting it all together hash, Hash default blocks: Block return value map method with, Making one array that’s based on another, the hard way methods using, How the method uses a block return value opening and closing files, Opening the file processing collections, A big collection of words to search through reject method with, Eliminating elements we don’t want, with a block split method with, Breaking a string into an array of words split method with, Breaking a string into an array of words understanding values and, Blocks have a return value using ampersand (&) to accept, Defining a method that takes blocks , Your Ruby Toolbox using yield keyword with, Using the “yield” keyword , Your Ruby Toolbox variables and, Blocks and variable scope , Don’t forget about variable scope! Boolean values methods named with ? returning, The verbose way to find array elements, using “each” , Your Ruby Toolbox operators, Conditionals truthy and falsy values, Hashes return “nil” by default using or (| |) operator for assignment, Using the Boolean “or” operator for assignment , Your Ruby Toolbox Bundler, #9 Bundler C call method, Defining a method that takes blocks , Block parameters call signatures in documentation, Arguments in call signatures , Your Ruby Toolbox chomp method, Calling “chomp” on the string object class instance method on objects, Why everything inherits from the Object class class keyword, Your first class class methods about, Class methods documentation on, Pool Puzzle Solution instance methods vs., Looking up class methods classes about, What methods are available on an object? , Designing a class Array, documentation on methods in, Read the docs for the superclass and mixins, too! (continued) as superclasses, Your Ruby Toolbox breaking methods into, Breaking up our giant methods into classes Comparable mixing into, The Comparable mixin , Implementing the spaceship operator on Steak core, Ruby’s core classes and modules , Docs for a class that doesn’t exist?! date, Docs for a class that doesn’t exist?! , Looking up classes and modules in the standard library defining, Your first class designing, Designing a class documentation on, Listing available classes and modules Employee adding initialize method to, Employee safety with “initialize” , “super” and “initialize” creating instances of, Creating new Employee instances defining, Payroll at Chargemore fixing rounding errors in, Fixing the salary rounding error in Employee implementing pay stubs for hourly employees through inheritance, Implementing hourly employees through inheritance setting object attributes, Using “format” to fix our pay stubs using self keyword, Call other methods on the same instance with “self” validation of accessor methods, “initialize” does an end-run around our validation Enumerable mixing into, A class to mix Enumerable into Enumerator, Blocks in call signatures Exception, Different rescue logic for different exceptions , Your Ruby Toolbox File, Opening the file Fixnum about, Calling a method on an object , Division with Ruby’s Fixnum class dividing by instances of, Division with Ruby’s Fixnum class Float vs., Division with Ruby’s Fixnum class Numeric as superclass of, Mixins built into Ruby operands and, Division with Ruby’s Float class rounding errors and, Fixing the salary rounding error in Employee Float about, Division with Ruby’s Fixnum class dividing by instances of, Division with Ruby’s Float class fixing rounding errors, Fixing the salary rounding error in Employee Fixnum vs., Division with Ruby’s Fixnum class Numeric as superclass of, Mixins built into Ruby operands and, Division with Ruby’s Float class inheriting from multiple, Not an option: Multiple inheritance initialize inherited from superclass, “super” and “initialize” instances of about, Designing a class creating, Your first class , Creating instances of our new animal classes ListWithCommas, Tests for ListWithCommas mixing Comparable module into, A preview of the Comparable mixin modules mixed into, Using modules as mixins , Mixins, behind the scenes naming, Breaking up our giant methods into classes NilClass, “nil” stands for nothing Numeric, adding comparison operator methods to, Mixins built into Ruby , Your Ruby Toolbox Object about, The Object class inheriting initialize method, Using optional parameters with “initialize” methods inherited from, Why everything inherits from the Object class setting as superclass, Your Ruby Toolbox , Mixins, behind the scenes object vs., What’s the difference between a class and an object? sharing methods between, Inheritance to the rescue! standard library as collection of, The Ruby standard library String comparison operator methods of, Mixins built into Ruby , Your Ruby Toolbox find_index method of, Finding the index of an array element include? method of, The verbose way to find array elements, using “each” , Your Ruby Toolbox inheriting methods, Mixins built into Ruby split method of, Breaking a string into an array of words testing, Testing a class Code Magnets exercises on constructing blocks, Blocks have a return value on creating classes, Updating our class diagram with instance methods on creating program using modules and classes, Mixins, behind the scenes on creating Sinatra route, Multiple routes in the same Sinatra app on hashes, Making the entire hash optional on making superclasses and subclasses, “super” and “initialize” on reconstructing YAML::Store code, Saving movies to a file with YAML::Store on rescue clauses, Exception messages on superclasses and subclasses, Overriding methods collections arrays as, Arrays (see also arrays) hashes as, Hashes: Labeling Data , Hashes (see also hashes) of methods, Mixins, behind the scenes processing, A big collection of words to search through (see also blocks: return values) colon (:) denoting Sinatra named parameter, Named parameters in Sinatra routes replacing hash rocket (=>) with, Leave off the braces! symbol references using, Attribute writers and readers command-line arguments, #4 Command-line arguments commas (,) joining strings with, A program we should have had automated tests for separating arguments by, Method arguments separating array elements, Arrays separating parameters by, Method names , Block parameters comments method about, The media-sharing app conditional assignment operator with, The conditional assignment operator creating mixins for comments, Creating a mixin for comments initialize method and revised, Why you shouldn’t add “initialize” to a mixin initializing instance variable within, Avoid using “initialize” methods in modules looking at revised, Using our comments mixin using comments mixin, Using our comments mixin using inheritance, The media-sharing app...using inheritance Comparable about, A preview of the Comparable mixin , How the Comparable methods work Enumerable vs., The Enumerable module mixing into classes, Implementing the spaceship operator on Steak spaceship operator ( < =>) and, Implementing the spaceship operator on Steak , Your Ruby Toolbox understanding, How the Comparable methods work using in classes, Implementing the spaceship operator on Steak comparison operators about, Your first Ruby expressions as methods, A preview of the Comparable mixin , How the Comparable methods work Boolean expressions and, Conditionals Comparable and, A preview of the Comparable mixin , How the Comparable methods work spaceship operator ( < =>) and, The spaceship operator compiling other languages, Use Ruby concatenation (+) symbol, Converting to strings conditional assignment operator, The conditional assignment operator conditional statements, Conditionals , Your Ruby Toolbox , CSV constants about, Constants , Your Ruby Toolbox naming, Constants constructors vs. initialize method, Using optional parameters with “initialize” core classes, Docs for a class that doesn’t exist?! CSV library, CSV curly braces { } denoting blocks, Block formats hash literals, Hashes , Returning something other than “nil” by default , Leave off the braces! using for string interpolation, String interpolation D Date class, Docs for a class that doesn’t exist?! , Looking up classes and modules in the standard library day method, Docs for a class that doesn’t exist?! decimal places fixing rounding errors, Fixing the salary rounding error in Employee Float vs. Fixum classes, Division with Ruby’s Fixnum class formatting numbers, Formatting numbers for printing def keyword, Defining methods division operator (/), Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method do keyword, Your first block do...end, block format, Your first block documentation about, Learning how to learn more adding documentation using comments, Adding your own documentation, with comments call signatures, Arguments in call signatures , Your Ruby Toolbox class methods, Pool Puzzle Solution for mixin methods, Read the docs for the superclass and mixins, too! for superclass methods, Read the docs for the superclass and mixins, too! HTML, HTML documentation , Your Ruby Toolbox initialize/new method, The “initialize” instance method appears as the “new” class method instance methods, Looking up instance methods popular sites for, HTML documentation rdoc command and, Where Ruby docs come from: rdoc , The “initialize” instance method appears as the “new” class method using search engine to find, The “initialize” instance method appears as the “new” class method dot (.) denoting class methods in documentation, Looking up class methods Float vs. Fixnum literals, Division with Ruby’s Fixnum class operator, calling methods using, Everything is an object! , Running scripts , Calling methods you’ve defined , Call other methods on the same instance with “self” double backslashes (\), Escape sequences in strings double quotes (“), Your first Ruby expressions (see also single quotes (')) #{...} notation inside, String interpolation , Ruby makes working with strings easy in double-quoted string, Escape sequences in strings specifying strings using, Your first Ruby expressions dRuby library, dRuby dump method for YAML, Converting objects to and from strings with YAML E each method about, The “each” method Enumerable methods calling, A class to mix Enumerable into hashes and, Hashes and “each” using, The “each” method, step-by-step , Using “each” with the “refund” method else statement, Conditionals avoiding use with unless statements, The opposite of “if” is “unless” Employee class adding initialize method to, Employee safety with “initialize” , “super” and “initialize” creating instances of, Creating new Employee instances defining, Payroll at Chargemore fixing rounding errors in, Fixing the salary rounding error in Employee implementing pay stubs for hourly employees through inheritance, Implementing hourly employees through inheritance setting object attributes, Using “format” to fix our pay stubs using self keyword, Call other methods on the same instance with “self” validation of accessor methods, “initialize” does an end-run around our validation encapsulation, Encapsulation end keyword, Conditionals , Defining methods , Your first class , Your first block , Using modules as mixins ensure clause, The ensure clause Enumerable about, Comparable and Enumerable: Ready-Made Mixes , The Enumerable module , Inside the Enumerable module , Read the docs for the superclass and mixins, too! Comparable vs., The Enumerable module documentation on, Read the docs for the superclass and mixins, too! methods, Our next mixin methods calling each method, A class to mix Enumerable into mixing into classes, A class to mix Enumerable into Enumerator class, Blocks in call signatures equality (= =) operator, Your first Ruby expressions , A preview of the Comparable mixin , How the Comparable methods work equals (=) sign assigning variables using, Variables in naming methods, Method names ERB defined, Accessing the HTML from Sinatra embedding tags, ERB embedding tags output embedding tag ( < %= %>), The ERB output embedding tag , Building HTML links to individual movies (continued) , An ERB template for an individual movie regular embedding tag ( < % %>), The regular embedding tag ERB library, Accessing the HTML from Sinatra erb method, Accessing the HTML from Sinatra ERB templates accessing instance variables within, Embedding a movie title in our HTML creating for HTML form, Getting an HTML form for adding a movie displaying objects, An ERB template for an individual movie setting local variables in, Embedding a movie title in our HTML error messages, using raise method to report errors, Using “raise” to report errors escape sequences, in strings, Escape sequences in strings Exception classes, Different rescue logic for different exceptions , Your Ruby Toolbox exceptions about, Exceptions: When something’s gone wrong differentiating between, Different rescue logic for different exceptions ensure clause, The ensure clause messages, Exception messages rescue clauses about, Ruby’s search for a rescue clause , Your Ruby Toolbox handling exceptions, Rescue clauses: A chance to fix the problem retry keyword in, Trying again after an error with “retry” specifying exception classes for, Specifying exception class for a rescue clause using, Using a rescue clause with our SmallOven class using raise method to report errors, Using “raise” to report errors ZeroDivisionError, Some other assertion methods exclamation mark (!) != (not equal to) operator, Conditionals in naming methods, Method names exercises on < li> HTML tag, Looping over several movie titles in our HTML on arrays and blocks, We’ve gotten rid of the repetitive loop code! , The finished product on assertions in testing, Some other assertion methods , Updating our code to use the “setup” method on Comparable, How the Comparable methods work on constructing blocks, Blocks have a return value on creating classes, Updating our class diagram with instance methods instances, Attribute writers and readers in action program using modules and classes, Mixins, behind the scenes Sinatra route, Multiple routes in the same Sinatra app on defining Sinatra routes, Defining routes in order of priority on definitions connected with inheritance, Overriding methods on Enumerable, Inside the Enumerable module on ERB tags, Pool Puzzle on expressions, Calling a method on an object on File class and blocks, Don’t forget about variable scope! on formatting numbers, Using “format” to fix our pay stubs on hashes, Hashes , Hashes are objects , nil (and only nil) is “falsy” , Making the entire hash optional on initializing instances, Using optional parameters with “initialize” on instance methods, Pool Puzzle on loading methods, Optional parameters on making hash of arrays, Hash default blocks: A shortcut on making superclasses and subclasses, “super” and “initialize” on method definitions and blocks, Block formats on method overriding and super keyword, A super-powered subclass on methods using hashes, Required keyword arguments on MiniTest, A closer look at the test code on mixins and modules, Mixins and method overriding on or (| |) operator for assignment, The conditional assignment operator on output of code from classes, Aliasing on placing class names and method definitions in class diagram, Subclasses keep inherited methods alongside new ones on POST requests, Setting up a Sinatra route for a POST request on processing arrays, Arrays are objects, too! on reconstructing YAML::Store code, Saving movies to a file with YAML::Store on rescue clauses, Exception messages on superclasses and subclasses, Overriding methods on terms related to storing data within objects, Attribute writers and readers in action on understanding retry keyword, Updating our oven code with “retry” explicit return values, Return values exponentiation (**) operator, Your first Ruby expressions expressions, Your first Ruby expressions F factory methods, An inefficient factory method false Boolean values, Conditionals falsy values, Hashes return “nil” by default File class closing files, Opening the file opening files, Opening the file find method, Finding a Movie in the YAML::Store , Finishing the Sinatra route for individual movies find_all method documentation on, Read the docs for the superclass and mixins, too! from Enumerable, Comparable and Enumerable: Ready-Made Mixes , Our next mixin passing array elements into blocks, Blocks have a return value , How the method uses a block return value , Your Ruby Toolbox find_index method, Finding the index of an array element Fireside Chats on associating methods and blocks, Block formats on differences between arrays and hashes, Hashes and “each” on modules and classes, Mixins, behind the scenes Fixnum class about, Calling a method on an object , Division with Ruby’s Fixnum class dividing by instances of, Division with Ruby’s Fixnum class Float vs., Division with Ruby’s Fixnum class Numeric as superclass of, Mixins built into Ruby operands and, Division with Ruby’s Float class rounding errors and, Fixing the salary rounding error in Employee Float class about, Division with Ruby’s Fixnum class dividing by instances of, Division with Ruby’s Float class fixing rounding errors, Fixing the salary rounding error in Employee Fixnum vs., Division with Ruby’s Fixnum class Numeric as superclass of, Mixins built into Ruby operands and, Division with Ruby’s Float class floating-point decimal, format sequence type (%f) for, Format sequences , Format sequence width with floating-point numbers numbers, format sequence width with, Format sequence width with floating-point numbers < form> HTML tag, Letting users add data with HTML forms format method, Formatting numbers for printing format sequences about, Format sequences types of, Format sequences , Your Ruby Toolbox width, Format sequence width forward slash (/) denoting regular expression literals, #5 Regular expressions division operator, Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method in Sinatra route paths, Named parameters in Sinatra routes Fowler, Chad (Programming Ruby), #5 Regular expressions , #9 Bundler Freeman, Eric, Head First HTML and CSS, Project directory structure G GET method for HTTP requests about, Request type handling requests, Sinatra routes , Our browser can GET the form... HTML links sending requests, Building HTML links to individual movies request paths, Multiple routes in the same Sinatra app gets method, Method arguments , Calling “chomp” on the string object greater than (>) sign as method, A preview of the Comparable mixin , How the Comparable methods work calling as method, Choice (of) beef comparison operator, Your first Ruby expressions greater than or equal to operator (>=), Conditionals as method, A preview of the Comparable mixin , How the Comparable methods work H < h1> HTML tag, Making a movie list in HTML hash (#) mark at start of method names in documentation, Instance methods denoted with # in the docs making comments using, Running scripts hash default blocks about, Our wish list for hash defaults assigning to hash, Hash default blocks: Assigning to the hash block return value, Hash default blocks: Block return value hash default objects vs., Using hash default objects safely rules for using, The rule of thumb for hash defaults hash default objects detailed look at, A more detailed look at hash default objects leaving off hash keys and, Hash parameters in our Candidate class modifying, We’re actually modifying the hash default object! problems with, Problems with a hash default object references to, The astronomer’s hash: Our final code rules for using, Hash default object rule #1: Don’t modify the default object using immutable objects as, Hash default object rule #1: Don’t modify the default object , Your Ruby Toolbox using numbers as default for, Returning something other than “nil” by default , Using hash default objects safely values returned from unassigned keys and, Your Ruby Toolbox , Our wish list for hash defaults hash keys assigning values to, A more detailed look at hash default objects , Hash default blocks: Assigning to the hash checking using if/else statements, nil (and only nil) is “falsy” leaving off in method arguments, Hash parameters in our Candidate class , Making the entire hash optional normalizing, Normalizing hash keys objects used as, Hashes referencing hash default object, Our wish list for hash defaults referring same object, Problems with a hash default object unassigned, Problems with a hash default object using nil with, Hash parameters in our Candidate class using square brackets [ ], Hashes , Returning something other than “nil” by default using symbols as parameter keys, A mess of method arguments hash literals omitting curly braces { } for method arguments, Leave off the braces! using curly braces { }, Hashes , Returning something other than “nil” by default hash rocket (=>), Leave off the braces! hashes about, Hashes , Hashes are objects arrays vs., Hashes , Hashes and “each” , Your Ruby Toolbox as method parameters, A mess of method arguments as objects, Hashes assigning values to, A more detailed look at hash default objects , Hash default blocks: Assigning to the hash creating new, Returning something other than “nil” by default , Your Ruby Toolbox , A more detailed look at hash default objects default object, Returning something other than “nil” by default , Your Ruby Toolbox each method and, Hashes and “each” Enumerable module and, The Enumerable module initialize methods using, Hash parameters in our Candidate class instance methods of, Hashes making optional as parameters, Leave off the braces! method arguments and, A mess of method arguments nil values, Hashes return “nil” by default , Making the entire hash optional regular parameters vs. hash parameters, A mess of method arguments returning values not nil, nil (and only nil) is “falsy” similarities between arrays and, Hashes typos in arguments, Making the entire hash optional using keyword arguments, Making the entire hash optional yielding two-element arrays, Hashes and “each” Head First HTML and CSS (Robson and Freeman), Project directory structure heap, The heap href attribute, Building HTML links to individual movies HTML documentation, HTML documentation , Read the docs for the superclass and mixins, too! (continued) , The “initialize” instance method appears as the “new” class method , Your Ruby Toolbox HTML files accessing from Sinatra, Accessing the HTML from Sinatra outputting with documentation, Where Ruby docs come from: rdoc web apps and, Browsers, requests, servers, and responses HTML forms action attribute, Setting the HTML form to send a POST request , Your Ruby Toolbox method attribute, Setting the HTML form to send a POST request , Your Ruby Toolbox saving and retrieving POST requests (see HTML pages: POST requests) users adding data with, Letting users add data with HTML forms HTML links, building, Building HTML links to individual movies HTML pages displaying data accessing instance variables, Embedding a movie title in our HTML ERB embedding tags, ERB embedding tags output from embedding tags, The ERB output embedding tag using output embedding tag ( < %= %>), The ERB output embedding tag , Pool Puzzle Solution using regular embedding tag ( < % %>), The regular embedding tag POST requests about, Saving and retrieving form data complete code for, Our complete app code converting objects to and from strings, Converting objects to and from strings with YAML displaying objects, An ERB template for an individual movie finding objects in YAML::Store, A system for finding Movies in the YAML::Store finding objects within files, Building HTML links to individual movies loading objects, Loading all movies from the MovieStore managing YAML::Store, A class to manage our YAML::Store posting requests, Our browser can GET the form... saving objects to YAML::Store, Saving objects to a file with YAML::Store setting form attributes, Setting the HTML form to send a POST request testing YAML::Store, Testing the MovieStore setting up data with HTML forms, Letting users add data with HTML forms with HTML tables, Letting users add data with HTML forms tags in, Making a movie list in HTML HTML tables about, HTML tables arranging text in form fields using, Letting users add data with HTML forms HTML tags < a>, Making a movie list in HTML , Building HTML links to individual movies (continued) < form>, Letting users add data with HTML forms < h1>, Making a movie list in HTML < input>, Letting users add data with HTML forms < label>, Letting users add data with HTML forms < li>, Making a movie list in HTML , The regular embedding tag < strong>, An ERB template for an individual movie < table>, HTML tables , An ERB template for an individual movie < td>, HTML tables < title>, Making a movie list in HTML < tr>, HTML tables < ul>, Making a movie list in HTML HTTP requests about, Request type parts of, Resource path POST requests, ... But it needs to POST the response Hunt, Andy (Programming Ruby), #5 Regular expressions , #9 Bundler I -I flag, A closer look at the test code , #8 Automating tasks with Rake id attribute, Building HTML links to individual movies , Using a named parameter to get a movie’s ID , Finding a Movie in the YAML::Store , Finishing the Sinatra route for individual movies if statements, Conditionals in ERB tags, The regular embedding tag inline, CSV if/else statements, Conditionals , Breaking up our giant methods into classes , Eliminating repetition...the WRONG way... , nil (and only nil) is “falsy” implicit return values, Return values include? method, The verbose way to find array elements, using “each” indentation, Conditionals index about, Your Ruby Toolbox finding for array element, Finding the index of an array element HTML file, Where Ruby docs come from: rdoc in arrays, Accessing arrays inheritance about, Inheritance: Relying on Your Parents adding methods to subclasses, Adding methods to subclasses designing hierarchies using, Overriding methods , Designing the animal class hierarchy initialize methods and, Using optional parameters with “initialize” , Inheritance and “initialize” methods from Object class, Why everything inherits from the Object class multiple, Not an option: Multiple inheritance of methods, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones , Overriding methods initialize method about, Using optional parameters with “initialize” appearing as new class method in documentation, The “initialize” instance method appears as the “new” class method arguments to, Arguments to “initialize” calling, The “initialize” method , Using optional parameters with “initialize” constructors vs., Using optional parameters with “initialize” default parameters for, Using optional parameters with “initialize” defining, The “initialize” method in creating YAML::Store, A class to manage our YAML::Store inheritance and, Inheritance and “initialize” leaving off hash keys with, Making the entire hash optional mixins and, Why you shouldn’t add “initialize” to a mixin modules and, Why you shouldn’t add “initialize” to a mixin , Mixins and method overriding overriding, “super” and “initialize” restoring, Restoring “initialize” methods returning values from, Using optional parameters with “initialize” setting instance attributes, A mess of method arguments super keyword and, “super” and “initialize” using keyword parameters with, Using keyword arguments with our Candidate class initializing instances, Using optional parameters with “initialize” (see also initialize method) code for, Your Ruby Toolbox Employee class adding initialize method to, Employee safety with “initialize” creating, Payroll at Chargemore creating instances of, Creating new Employee instances fixing rounding errors in, Fixing the salary rounding error in Employee setting object attributes, Using “format” to fix our pay stubs factory methods about, An inefficient factory method calling on class, Class methods implementing pay stubs for hourly employees through inheritance, Implementing hourly employees through inheritance using dot (,) operator in, Call other methods on the same instance with “self” inline conditionals, CSV < input> HTML tag, Letting users add data with HTML forms inspect method about, Inspecting objects with the “inspect” and “p” methods , Why everything inherits from the Object class identifying objects with, Fixing the astronomer’s program , Problems with a hash default object on arrays, Accessing arrays on hashes, Hashes p method and, “nil” stands for nothing instance methods about, Designing a class accessor methods as type of, Attribute writers and readers in action calling, Updating our class diagram with instance methods class methods vs., Looking up class methods documentation on, Looking up instance methods in mixins and modules, Using modules as mixins , Your Ruby Toolbox initialize as, Inheritance and “initialize” subclasses inheriting, Subclasses keep inherited methods alongside new ones instance variables about, Designing a class , Too many arguments (again) , Instance variables live as long as the instance does accessing, Your Ruby Toolbox accessing via attribute accessors, Our complete Dog class accessor methods for, Attribute writers and readers in action defined within Sinatra route blocks, Embedding a movie title in our HTML encapsulation and, Encapsulation instance methods with, Our complete Dog class matching attribute accessor names, Instance variables belong to the object, not the class! modules and, Using our comments mixin objects and, Instance variables belong to the object, not the class! outside of instance methods, Too many arguments (again) , Instance variables live as long as the instance does storing data outside of instance method, Attribute writers and readers in action subclasses and, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones instances creating Employee, Creating new Employee instances initializing, creating Employee class, Payroll at Chargemore of classes, Designing a class , Your first class , Creating instances of our new animal classes instance_variables method, Instance variables belong to the object, not the class! integer index in arrays, Accessing arrays integers, format sequence type (%i) for, Format sequences integration tests, A program we should have had automated tests for interpolating values in strings, String interpolation irb about, Use Ruby—interactively exercises on working with expressions using, Calling a method on an object K keyword arguments hash parameters and, Keyword arguments in methods, Your Ruby Toolbox keywords and, A program we should have had automated tests for , Getting the test to pass class, Your first class def, Defining methods do, Your first block end, Conditionals , Defining methods , Your first class , Your first block , Using modules as mixins retry, Trying again after an error with “retry” return, Returning from a method early , Class methods , Blocks have a return value self, Call other methods on the same instance with “self” , Implementing hourly employees through inheritance , Your Ruby Toolbox , The “each” method super, The “super” keyword about, The “super” keyword initialize and, “super” and “initialize” omitting parentheses with, The “super” keyword return value of, Your Ruby Toolbox using, A super-powered subclass yield, Using the “yield” keyword , The “each” method , Your Ruby Toolbox L < label> HTML tag, Letting users add data with HTML forms length method on arrays, Looping over the items in an array , Your Ruby Toolbox on hashes, Hashes less than ( < ) sign as method, A preview of the Comparable mixin , How the Comparable methods work comparison operator, Your first Ruby expressions indicating inheritance, Defining a subclass (is really easy) less than or equal to operator ( < =), Conditionals as method, Mixins built into Ruby , How the Comparable methods work < li> HTML tag, Making a movie list in HTML lib directory, Testing a class , Your Ruby Toolbox , Project directory structure , Setting up a Movie object in the Sinatra app libraries CSV, CSV dRuby, dRuby ERB, Accessing the HTML from Sinatra MiniTest (see MiniTest library) Ruby standard, The Ruby standard library , CSV WEBrick, Your computer is talking to itself , Sinatra routes , Our browser can GET the form... , Building HTML links to individual movies YAML, Converting objects to and from strings with YAML ListWithCommas class, Tests for ListWithCommas literals array, Hashes Float vs. Fixnum, Division with Ruby’s Fixnum class for numbers, Updating our class diagram with instance methods , Using “format” to fix our pay stubs , Your Ruby Toolbox hash leaving off curly braces { }, Leave off the braces! using curly braces { }, Hashes , Returning something other than “nil” by default regular expression, #5 Regular expressions load method, Converting objects to and from strings with YAML LOAD_PATH, Sinatra takes requests local variables, methods and, Local variables live until the method ends loops about, Your Ruby Toolbox arrays and, Looping over the items in an array , The “each” method, step-by-step , Using “each” with the “refund” method until, Loops while, Loops , Looping over the items in an array , The “each” method, step-by-step , Using “each” with the “refund” method M map method documentation on, Read the docs for the superclass and mixins, too! (continued) on Enumerable, Comparable and Enumerable: Ready-Made Mixes , Our next mixin using, Making one array based on another, using “map” , Mixing Enumerable into our class , Loading all movies from the MovieStore math operators about, Your first Ruby expressions addition operator (+), Your first Ruby expressions , “/” is a method as methods, “/” is a method division (/), Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method exponentiation (**), Your first Ruby expressions multiplication (*), Your first Ruby expressions , “/” is a method subtraction (-), Your first Ruby expressions , “/” is a method Matsumoto, Yukihiro “Matz,” developer of Ruby, The Ruby philosophy max method, Finding the next available movie ID method arguments about, Method arguments , Method names hashes and, A mess of method arguments method attribute of < form> HTML tag, Setting the HTML form to send a POST request method body, Defining methods , Method names method calls arguments passing with, Optional parameters on objects, Everything is an object! parentheses with, Method arguments return values, Calling a method on an object method definition, Optional parameters methods about, What methods are available on an object? abs, Mixins built into Ruby accepting blocks, Defining a method that takes blocks accepting parameters, Defining methods accessor, Attribute accessor methods (see also attribute accessor methods; attribute writer methods) about, Attribute accessor methods as type of instance method, Attribute writers and readers in action calling, Using accessor methods ensuring data is valid with, Ensuring data is valid with accessors add_comment about, The media-sharing app creating mixins for comments, Creating a mixin for comments initialize method and revised, Why you shouldn’t add “initialize” to a mixin initializing instance variable within, Avoid using “initialize” methods in modules looking at revised, Using our comments mixin using comments mixin, Using our comments mixin using conditional assignment operator with, The conditional assignment operator using inheritance, The media-sharing app...using inheritance age=, Ensuring data is valid with accessors ancestors class, Mixins and method overriding , Your Ruby Toolbox assert, MiniTest: Ruby’s standard unit-testing library , Tests for ListWithCommas , Test failure messages , Your Ruby Toolbox assert_equal, A better way to assert that two values are equal assert_includes, Some other assertion methods assert_instance_of, Some other assertion methods assert_raises, Some other assertion methods attribute accessor defining via attr_accessor, Attribute writers and readers matching instance variable names, Instance variables belong to the object, not the class! subclasses inheriting, Inheritance to the rescue! using, Attribute writers and readers in action attribute reader about, Attribute accessor methods defining, Ensuring data is valid with accessors , When “self” is optional defining via attr_reader, Attribute writers and readers naming, Using accessor methods using, Attribute writers and readers in action attribute writer about, Attribute accessor methods calling, Attribute accessor methods , Call other methods on the same instance with “self” , When “self” is optional defining, Ensuring data is valid with accessors defining via attr_writer, Attribute writers and readers naming, Using accessor methods using, Attribute writers and readers in action validation and, Ensuring data is valid with accessors available object, What methods are available on an object? between?, A preview of the Comparable mixin , How the Comparable methods work blocks and associating with, Block formats defining methods that take blocks, Defining a method that takes blocks flow of control between methods and blocks, Flow of control between a method and block method calling block multiple times, Calling a block multiple times passing into single method many, Calling the same method with different blocks same block across multiple methods, Block parameters similarities between, Blocks have a return value breaking into classes, Breaking up our giant methods into classes call, Defining a method that takes blocks , Block parameters calling, Calling methods you’ve defined , #7 Call any method, even undefined ones class about, Why everything inherits from the Object class , Class methods documentation on, Pool Puzzle Solution instance methods vs., Looking up class methods comparison operators as, A preview of the Comparable mixin , How the Comparable methods work copy and pasting to change, Copy, paste... Such a waste... data having, Everything is an object! day, Docs for a class that doesn’t exist?! defining, Defining methods DELETE, Request type documentation on, Instance method documentation dump, Converting objects to and from strings with YAML each about, The “each” method Enumerable methods calling, A class to mix Enumerable into hashes and, Hashes and “each” using, The “each” method, step-by-step , Using “each” with the “refund” method erb, Accessing the HTML from Sinatra errors messages and return values of, Don’t use method return values for error messages factory, An inefficient factory method find, Finding a Movie in the YAML::Store , Finishing the Sinatra route for individual movies find_all documentation on, Read the docs for the superclass and mixins, too! from Enumerable, Comparable and Enumerable: Ready-Made Mixes , Our next mixin passing array elements into blocks, Blocks have a return value , How the method uses a block return value , Your Ruby Toolbox find_index, Finding the index of an array element format, Formatting numbers for printing from Enumerable, The Enumerable module GET (HTTP) about, Request type handling requests, Sinatra routes , Our browser can GET the form... HTML links sending requests, Building HTML links to individual movies request paths, Multiple routes in the same Sinatra app gets, Method arguments , Calling “chomp” on the string object in top-level execution environment, Calling methods you’ve defined include?, The verbose way to find array elements, using “each” , Putting it all together inheritance about, Inheritance to the rescue! , The media-sharing app , Mixins, behind the scenes problems with, One of these classes is not (quite) like the others initialize about, Using optional parameters with “initialize” arguments to, Arguments to “initialize” calling, The “initialize” method , Using optional parameters with “initialize” constructors vs., Using optional parameters with “initialize” default parameters for, Using optional parameters with “initialize” defining, The “initialize” method in creating YAML::Store, A class to manage our YAML::Store inheritance and, Inheritance and “initialize” leaving off hash keys with, Making the entire hash optional mixins and, Why you shouldn’t add “initialize” to a mixin modules and, Why you shouldn’t add “initialize” to a mixin , Mixins and method overriding overriding, “super” and “initialize” restoring, Restoring “initialize” methods returning values from, Using optional parameters with “initialize” setting instance attributes, A mess of method arguments super keyword and, “super” and “initialize” using keyword parameters with, Using keyword arguments with our Candidate class inspect about, Inspecting objects with the “inspect” and “p” methods , Why everything inherits from the Object class identifying objects with, Fixing the astronomer’s program , Problems with a hash default object on arrays, Accessing arrays on hashes, Hashes p method and, “nil” stands for nothing instance about, Designing a class accessor methods as type of, Attribute writers and readers in action calling, Updating our class diagram with instance methods class methods vs., Looking up class methods documentation on, Looking up instance methods in mixins and modules, Using modules as mixins initialize as, Inheritance and “initialize” subclasses inheriting, Subclasses keep inherited methods alongside new ones instance_variables, Instance variables belong to the object, not the class! join, A program we should have had automated tests for , Tests for ListWithCommas , Getting the test to pass keyword arguments in, Your Ruby Toolbox length on arrays, Looping over the items in an array , Your Ruby Toolbox on hashes, Hashes load, Converting objects to and from strings with YAML local variables and, Local variables live until the method ends map documentation on, Read the docs for the superclass and mixins, too! (continued) on Enumerable, Comparable and Enumerable: Ready-Made Mixes , Our next mixin using, Making one array based on another, using “map” , Mixing Enumerable into our class , Loading all movies from the MovieStore math operators as, “/” is a method max, Finding the next available movie ID methods, What methods are available on an object? mixins documentation on, Read the docs for the superclass and mixins, too! overriding, Mixins and method overriding modulo, Mixins built into Ruby month, Docs for a class that doesn’t exist?! name=, Ensuring data is valid with accessors , Creating new Employee instances , “initialize” does an end-run around our validation , Back to the hash of planets and moons naming, Method names new, Updating our class diagram with instance methods , Class methods , The “initialize” instance method appears as the “new” class method object_id, Aliasing , Fixing the astronomer’s program open, Opening the file , Looking up class methods operators as, Arrays are objects, too! , A preview of the Comparable mixin , How the Comparable methods work overriding about, Overriding methods , Overriding a method in the Animal subclasses to_s method, Difficulties displaying Dogs p, Inspecting objects with the “inspect” and “p” methods , “nil” stands for nothing , Accessing arrays parameters in, Method names , Our objects don’t “know” their names or ages! params, Setting up a Sinatra route for a POST request , Named parameters in Sinatra routes pop, Arrays are objects, too! , Arrays are objects, too! POST (HTTP), Request type , ... But it needs to POST the response print, Running scripts , Calling “chomp” on the string object print_pay_stub defining, An Employee class errors, Using “format” to fix our pay stubs fixing rounding error, Fixing the salary rounding error in Employee formatting numbers, Formatting numbers for printing , Format sequence width with floating-point numbers using algorithms with, When “self” is optional using self keyword with, Call other methods on the same instance with “self” private, #3 Private methods PUT (HTTP), Request type puts about, Running scripts method arguments and, Method arguments nil and, “nil” stands for nothing to_s method and, Difficulties displaying Dogs , Overriding the inherited method with arrays, The repeating loop raise, Errors—the “emergency stop” button , Don’t use method return values for error messages , We need a description of the problem from its source rand, Calling a method on an object redirect, Using our MovieStore class in the Sinatra app reject on Enumerable, Inside the Enumerable module using, Eliminating elements we don’t want, with a block , Mixing Enumerable into our class require, loading libraries with, The Ruby standard library , A closer look at the test code , Your Ruby Toolbox return value of, Your Ruby Toolbox returning values from, Return values roots, Finding the next available movie ID , Loading all movies from the MovieStore salary=, Creating new Employee instances , “initialize” does an end-run around our validation save, A class to manage our YAML::Store setup, The “setup” method , Your Ruby Toolbox shift, Arrays are objects, too! , Arrays are objects, too! singleton, #6 Singleton methods slice, A program we should have had automated tests for split, Breaking a string into an array of words String class inheriting, Mixins built into Ruby sub, #5 Regular expressions subclass adding, Adding methods to subclasses defining own, Adding methods to subclasses overriding in, Overriding methods superclass, The Object class , “super” and “initialize” , Read the docs for the superclass and mixins, too! teardown, The “teardown” method , Your Ruby Toolbox test_, methods beginning with, MiniTest: Ruby’s standard unit-testing library , A closer look at the test code today, Docs for a class that doesn’t exist?! to_f, Converting strings to numbers to_i, Converting strings to numbers , Your Ruby Toolbox to_s, Converting to strings , Your Ruby Toolbox , Difficulties displaying Dogs , “nil” stands for nothing transaction, Saving objects to a file with YAML::Store , Loading all movies from the MovieStore (continued) type=, Back to the hash of planets and moons use_headlights, Defining methods , Method names , Optional parameters year, Docs for a class that doesn’t exist?! methods method, What methods are available on an object? MiniTest library about, Unit Testing: Code Quality Assurance , MiniTest: Ruby’s standard unit-testing library asserting two values are equal, A better way to assert that two values are equal assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods examining code, A closer look at the test code , Your Ruby Toolbox red, green, refactor cycle and, A closer look at the test code , Tests for ListWithCommas removing duplicated code from testing, Removing duplicated code from your tests running tests, Running a test setup method, The “setup” method testing classes, Testing a class minus sign (-), subtraction operator, Your first Ruby expressions , “/” is a method mixins about, Using modules as mixins , Your Ruby Toolbox Comparable about, Comparable and Enumerable: Ready-Made Mixes , A preview of the Comparable mixin Enumerable vs., The Enumerable module implementing spaceship operator ( < =>) for, Implementing the spaceship operator on Steak , Your Ruby Toolbox mixing into classes, The Comparable mixin understanding, How the Comparable methods work using in classes, Implementing the spaceship operator on Steak complete code for, Our complete code creating, Creating a mixin for comments documentation on, Read the docs for the superclass and mixins, too! Enumerable about, Comparable and Enumerable: Ready-Made Mixes Comparable vs., The Enumerable module documentation on, Read the docs for the superclass and mixins, too! methods, Our next mixin methods calling each method, A class to mix Enumerable into mixing into classes, A class to mix Enumerable into initialize method and, Why you shouldn’t add “initialize” to a mixin method overriding and, Mixins and method overriding methods in, Using modules as mixins , Your Ruby Toolbox using, Using our comments mixin using modules as, Using modules as mixins modules about, Using modules as mixins , Your Ruby Toolbox classes vs., Mixins, behind the scenes Comparable, A preview of the Comparable mixin complete code for, Our complete code core, Ruby’s core classes and modules Enumerable, The Enumerable module instance methods in, Using modules as mixins , Your Ruby Toolbox mixing into classes, Using modules as mixins , Your Ruby Toolbox naming, Mixins, behind the scenes , Your Ruby Toolbox using as mixins, Using modules as mixins YAML, Converting objects to and from strings with YAML modulo method, Mixins built into Ruby month method, Docs for a class that doesn’t exist?! multiplication operator (*), Your first Ruby expressions , “/” is a method N :name symbol, Attribute writers and readers name= method, Ensuring data is valid with accessors , Creating new Employee instances , “initialize” does an end-run around our validation , Back to the hash of planets and moons naming attribute reader method, Using accessor methods classes, Breaking up our giant methods into classes constants, Constants methods, Method names modules, Mixins, behind the scenes symbols, Attribute writers and readers variables, Method names , Attribute writers and readers new method, Updating our class diagram with instance methods , Class methods , The “initialize” instance method appears as the “new” class method nil about, Using “format” to fix our pay stubs arrays returning, Accessing arrays as only falsy value, Hashes return “nil” by default errors related to, “/” is a method hashes returning, Hashes return “nil” by default , Making the entire hash optional NilClass, “nil” stands for nothing normalizing hash keys, Normalizing hash keys numbers converting strings to, Converting strings to numbers displaying dollar amounts using decimal places, Creating new Employee instances about, Creating new Employee instances fixing rounding errors, Fixing the salary rounding error in Employee Float vs. Fixum classes, Division with Ruby’s Fixnum class formatting, Formatting numbers for printing literals creating numbers and, Updating our class diagram with instance methods with decimal points, Using “format” to fix our pay stubs , Your Ruby Toolbox Numeric class, adding comparison operator methods to, Mixins built into Ruby , Your Ruby Toolbox O Object class about, The Object class as superclass, Your Ruby Toolbox , Mixins, behind the scenes inheriting initialize method, Using optional parameters with “initialize” methods inherited from, Why everything inherits from the Object class object ID, Fixing the astronomer’s program , Problems with a hash default object , Hash default object rule #1: Don’t modify the default object object-oriented language, Ruby as, Everything is an object! objects arrays as, Arrays are objects, too! calling method values returned from, Calling a method on an object calling methods on, Everything is an object! classes vs., What’s the difference between a class and an object? creating with new method, Your first class ERB templates displaying, An ERB template for an individual movie finding in YAML::Store, A system for finding Movies in the YAML::Store , Finding a Movie in the YAML::Store heap and, References storing data in instance variables, Instance variables live as long as the instance does object_id method, Aliasing , Fixing the astronomer’s program open method, Opening the file , Looking up class methods operands, with Fixum and Float classes, Division with Ruby’s Float class or (| |) operator, Conditionals , Using the Boolean “or” operator for assignment , Your Ruby Toolbox , Finding the next available movie ID output embedding tag ( < %= %>), The ERB output embedding tag , Pool Puzzle Solution , Building HTML links to individual movies (continued) , An ERB template for an individual movie overriding methods about, Overriding methods , Overriding a method in the Animal subclasses to_s method, Difficulties displaying Dogs P p method, Inspecting objects with the “inspect” and “p” methods , “nil” stands for nothing , Accessing arrays parameters arguments vs., Optional parameters for initialize method, Using optional parameters with “initialize” hashes, A mess of method arguments in method definitions, Method names , Our objects don’t “know” their names or ages! keyword arguments and hash, Keyword arguments making hashes optional, Leave off the braces! of blocks, Block parameters , Blocks have a return value , A closer look at the block return values , The return values for “reject” optional, Required keyword arguments regular parameters vs. hash, A mess of method arguments using parentheses with, Defining methods params method, Setting up a Sinatra route for a POST request , Named parameters in Sinatra routes parentheses ( ) using with parameters, Defining methods with method calls, Method arguments percent (%) sign, format sequences, Format sequences performance tests, A program we should have had automated tests for plus (+) sign += operator, Variables addition operator, Your first Ruby expressions , “/” is a method for concatenation, Converting to strings Pool Puzzle exercises on arrays and blocks, We’ve gotten rid of the repetitive loop code! on assertions in testing, Updating our code to use the “setup” method on Comparable, How the Comparable methods work on ERB tags, Pool Puzzle on initializing instances, Using optional parameters with “initialize” on instance methods, Pool Puzzle on methods and classes, Attribute writers and readers in action pop method, Arrays are objects, too! , Arrays are objects, too! POST method, for HTTP requests, Request type , ... But it needs to POST the response print method, Running scripts , Calling “chomp” on the string object print_pay_stub method defining, An Employee class errors, Using “format” to fix our pay stubs , “initialize” does an end-run around our validation , Call other methods on the same instance with “self” fixing rounding error, Fixing the salary rounding error in Employee formatting numbers, Formatting numbers for printing , Format sequence width with floating-point numbers , Using “format” to fix our pay stubs using algorithms with, When “self” is optional using self keyword with, Call other methods on the same instance with “self” private methods, #3 Private methods procs, Block parameters Programming Ruby (Thomas et al.), #5 Regular expressions , #9 Bundler PUT method, for HTTP requests, Request type puts method about, Running scripts method arguments and, Method arguments nil and, “nil” stands for nothing to_s method and, Difficulties displaying Dogs , Overriding the inherited method with arrays, The repeating loop Q quality assurance code asserting two values are equal, A better way to assert that two values are equal automated testing, Automated tests find your bugs before someone else does MiniTest about, Unit Testing: Code Quality Assurance , MiniTest: Ruby’s standard unit-testing library assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods examining code, A closer look at the test code , Your Ruby Toolbox running tests, Running a test setup method, The “setup” method testing classes, Testing a class red, green, refactor cycle and, A closer look at the test code , Tests for ListWithCommas removing duplicated code from testing, Removing duplicated code from your tests unit tests, Unit Testing: Code Quality Assurance question mark (?), in naming methods, Method names , The verbose way to find array elements, using “each” R raise method, Errors—the “emergency stop” button , Don’t use method return values for error messages , We need a description of the problem from its source Rake tool, #8 Automating tasks with Rake rand method, Calling a method on an object , Generating a random number random numbers, generating, Calling a method on an object , Generating a random number .rb filename extension, The Ruby standard library rdoc command, Ruby documentation and, Where Ruby docs come from: rdoc , The “initialize” instance method appears as the “new” class method red, green, refactor cycle, A closer look at the test code , Tests for ListWithCommas redirect method, Using our MovieStore class in the Sinatra app references about, References aliasing and, Aliasing hash default blocks receiving, Hash default blocks identifying referenced object, Fixing the astronomer’s program to hash default object, Our wish list for hash defaults to same object, Fixing the astronomer’s program understanding, The rule of thumb for hash defaults regular embedding tag ( < % %>), The regular embedding tag regular expressions, #5 Regular expressions reject method on Enumerable, Inside the Enumerable module using, Eliminating elements we don’t want, with a block , Mixing Enumerable into our class request routes, Sinatra, Sinatra routes , Multiple routes in the same Sinatra app request types, HTTP, Request type , Sinatra routes require method, The Ruby standard library , A closer look at the test code , Your Ruby Toolbox rescue clauses => with, Exception messages about, Ruby’s search for a rescue clause , Your Ruby Toolbox accessing exception messages, Exception messages differentiating between exceptions, Different rescue logic for different exceptions handling exceptions, Rescue clauses: A chance to fix the problem retry keyword in, Trying again after an error with “retry” specifying exception classes for, Specifying exception class for a rescue clause using, Using a rescue clause with our SmallOven class resource path, for HTTP requests, Request type , Resource path resources, for learning Ruby, #9 Bundler retry keyword, Trying again after an error with “retry” return keyword, Returning from a method early , Class methods , Blocks have a return value return statements, Your Ruby Toolbox return value of methods, Your Ruby Toolbox Robson, Elisabeth, Head First HTML and CSS, Project directory structure roots method, Finding the next available movie ID , Loading all movies from the MovieStore rounding errors, fixing, Fixing the salary rounding error in Employee routes, Sinatra defining, Sinatra routes , Multiple routes in the same Sinatra app differentiating by resource path, Multiple routes in the same Sinatra app instance variables defined within blocks, Embedding a movie title in our HTML named parameters for, Named parameters in Sinatra routes priority order, Defining routes in order of priority requests and, Sinatra routes Ruby about, More with Less: Code the Way You Want as object-oriented language, Everything is an object! benefits of using, Use Ruby determining version number, Get Ruby getting, Get Ruby resources for learning, #9 Bundler running, Use Ruby running code, Use Ruby Ruby 2.0, required keyword arguments in, Required keyword arguments Ruby documentation about, Learning how to learn more adding documentation using hash (#) mark, Adding your own documentation, with comments call signatures, Arguments in call signatures , Your Ruby Toolbox class methods, Pool Puzzle Solution core classes and modules, Ruby’s core classes and modules for mixin methods, Read the docs for the superclass and mixins, too! for superclass methods, Read the docs for the superclass and mixins, too! HTML, HTML documentation , Your Ruby Toolbox initialize methods appearing as new class method in, The “initialize” instance method appears as the “new” class method looking up instance methods, Looking up instance methods popular sites for, HTML documentation rdoc command and, Where Ruby docs come from: rdoc , The “initialize” instance method appears as the “new” class method Ruby standard library, The Ruby standard library using search engine to find, The “initialize” instance method appears as the “new” class method Ruby interpreter, Get Ruby , Use Ruby—interactively Ruby on Rails, Sinatra takes requests , Multiple routes in the same Sinatra app , Ruby on Rails Ruby standard library, The Ruby standard library , CSV RubyGems command-line tool, Sinatra takes requests downloading and installing libraries with, Sinatra takes requests S salary= method, Creating new Employee instances , “initialize” does an end-run around our validation save method, A class to manage our YAML::Store scope resolution (: :) operator, marking class methods in documentation, Looking up class methods , The “initialize” instance method appears as the “new” class method scripts, Use Ruby search engines, finding Ruby HTML documentation in, HTML documentation , The “initialize” instance method appears as the “new” class method self keyword, Call other methods on the same instance with “self” , Implementing hourly employees through inheritance , Your Ruby Toolbox , The “each” method semicolon (;), using to separate statements, String interpolation setup method, The “setup” method , Your Ruby Toolbox shift method, Arrays are objects, too! , Arrays are objects, too! Sinatra about, Sinatra takes requests displaying data accessing instance variables, Embedding a movie title in our HTML ERB embedding tags, ERB embedding tags output from embedding tags, The ERB output embedding tag using output embedding tag ( < %= %>), The ERB output embedding tag , Pool Puzzle Solution using regular embedding tag ( < % %>), The regular embedding tag handling requests serving HTML, Accessing the HTML from Sinatra setting up routes, Multiple routes in the same Sinatra app installing, Installing the Sinatra gem named parameters for routes, Named parameters in Sinatra routes POST requests about, Saving and retrieving form data complete code for, Our complete app code converting objects to and from strings, Converting objects to and from strings with YAML displaying objects, An ERB template for an individual movie finding objects in YAML::Store, A system for finding Movies in the YAML::Store finding objects within files, Building HTML links to individual movies loading objects, Loading all movies from the MovieStore managing YAML::Store, A class to manage our YAML::Store posting requests, Our browser can GET the form... saving objects to YAML::Store, Saving objects to a file with YAML::Store setting form attributes, Setting the HTML form to send a POST request testing YAML::Store, Testing the MovieStore routes defining, Sinatra routes , Multiple routes in the same Sinatra app instance variables defined within blocks, Embedding a movie title in our HTML multiple routes in same app, Multiple routes in the same Sinatra app named parameters for, Named parameters in Sinatra routes priority order, Defining routes in order of priority setting up data with HTML forms, Letting users add data with HTML forms with HTML tables, Letting users add data with HTML forms simple app for, A simple Sinatra app Sinatra gem installing, Installing the Sinatra gem users installing files in directory, Installing the Sinatra gem single quotes ('), Your first Ruby expressions (see also double quotes (“)) specifying strings using, Your first Ruby expressions singleton methods, #6 Singleton methods slash (/) denoting regular expression literals, #5 Regular expressions division operator, Your first Ruby expressions , Division with Ruby’s Fixnum class , “/” is a method in Sinatra routes, Named parameters in Sinatra routes slice method, A program we should have had automated tests for space characters, in Ruby, Same class, same attribute values spaceship operator ( < =>) about, The spaceship operator implementing as method, Implementing the spaceship operator on Steak , Your Ruby Toolbox split method, Breaking a string into an array of words square brackets [ ] accessing arrays with, Accessing arrays accessing hashes with, Hashes , Returning something other than “nil” by default denoting array literals, Arrays in arguments in documentation, Arguments in call signatures standard library, The Ruby standard library , CSV StandardError subclasses, Exception classes , Updating our oven code with custom exception classes statements conditional, Conditionals , Your Ruby Toolbox return, Your Ruby Toolbox separating, String interpolation String class comparison operator methods of, Mixins built into Ruby , Your Ruby Toolbox find_index method of, Finding the index of an array element include? method of, The verbose way to find array elements, using “each” , Your Ruby Toolbox inheriting methods, Mixins built into Ruby split method of, Breaking a string into an array of words string interpolation, String interpolation strings about, Your first Ruby expressions converting to arrays, Arrays are objects, too! converting to numbers, Converting strings to numbers escape sequences in, Escape sequences in strings format sequence type (%s) for, Format sequences interpolation, String interpolation , Ruby makes working with strings easy < strong> HTML tag, An ERB template for an individual movie sub method, #5 Regular expressions subclasses calling overridden methods from, The “super” keyword defining, Defining a subclass (is really easy) having own subclasses, Overriding methods inheritance attribute accessor methods, Inheritance to the rescue! from superclass, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones , Overriding methods instance methods, Subclasses keep inherited methods alongside new ones inheritance hierarchies and, Designing the animal class hierarchy instance variables and, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones methods adding, Adding methods to subclasses defining own, Adding methods to subclasses overriding, Overriding methods of StandardError, Exception classes , Updating our oven code with custom exception classes overriding inherited methods, Overriding methods , Overriding a method in the Animal subclasses overriding methods from superclasses, Mixins and method overriding sharing methods between classes with, Inheritance to the rescue! super keyword and, A super-powered subclass subtraction operator (-), Your first Ruby expressions , “/” is a method super keyword, The “super” keyword about, The “super” keyword initialize and, “super” and “initialize” omitting parentheses with, The “super” keyword return value of, Your Ruby Toolbox using, A super-powered subclass superclass method, The Object class , “super” and “initialize” superclasses classes as, Your Ruby Toolbox , Mixins, behind the scenes defining, Defining a superclass (requires nothing special) designing inheritance hierarchies using, Designing the animal class hierarchy documentation on, Read the docs for the superclass and mixins, too! documentation on methods in, Read the docs for the superclass and mixins, too! initialize methods and inheriting from Object, Using optional parameters with “initialize” method lookup and, Overriding methods mixins and, Using modules as mixins overriding methods from about, Overriding methods , We need to get at the overridden method! calling overridden methods, The “super” keyword sharing methods between classes with, Inheritance to the rescue! subclasses inheritance from, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones , Overriding methods subclasses overriding methods from, Mixins and method overriding symbols, Ruby, Attribute writers and readers T < table> HTML tag, HTML tables , An ERB template for an individual movie < td> HTML tag, HTML tables teardown method, The “teardown” method , Your Ruby Toolbox testing asserting two values are equal, A better way to assert that two values are equal assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods automated about, Automated tests find your bugs before someone else does examining code, A closer look at the test code , Your Ruby Toolbox MiniTest in, Unit Testing: Code Quality Assurance , MiniTest: Ruby’s standard unit-testing library , Testing a class need for, A program we should have had automated tests for running tests, Running a test red, green, refactor cycle and, A closer look at the test code , Tests for ListWithCommas removing duplicated code from, Removing duplicated code from your tests setup method, The “setup” method unit tests, Unit Testing: Code Quality Assurance test_, methods beginning with, MiniTest: Ruby’s standard unit-testing library , A closer look at the test code Thomas, Dave (Programming Ruby), #5 Regular expressions , #9 Bundler < title> HTML tag, Making a movie list in HTML today method, Docs for a class that doesn’t exist?! top-level execution environment, methods in, Calling methods you’ve defined to_f method, Converting strings to numbers to_i method, Converting strings to numbers , Your Ruby Toolbox to_s method, Converting to strings , Your Ruby Toolbox , Difficulties displaying Dogs , “nil” stands for nothing < tr> HTML tag, HTML tables transaction method, Saving objects to a file with YAML::Store , Loading all movies from the MovieStore (continued) true Boolean values, Conditionals truthy values, Hashes return “nil” by default type= method, Back to the hash of planets and moons U < ul> HTML tag, Making a movie list in HTML unit tests about, Unit Testing: Code Quality Assurance , A program we should have had automated tests for asserting two values are equal, A better way to assert that two values are equal assert_includes method, Some other assertion methods assert_instance_of method, Some other assertion methods assert_raises method, Some other assertion methods automated about, Automated tests find your bugs before someone else does examining code, A closer look at the test code , Your Ruby Toolbox MiniTest in, Unit Testing: Code Quality Assurance , MiniTest: Ruby’s standard unit-testing library , Testing a class need for, A program we should have had automated tests for running tests, Running a test red, green, refactor cycle and, A closer look at the test code , Tests for ListWithCommas removing duplicated code from testing, Removing duplicated code from your tests setup imethod, The “setup” method unless statements if statements vs., The opposite of “if” is “unless” in regular embedding tag ( < % %>), The regular embedding tag inline, CSV until loops, Loops URLs components of, Your computer is talking to itself , Resource path spaces in, A system for finding Movies in the YAML::Store specifying port number in, Your computer is talking to itself use_headlights method, Defining methods , Method names , Optional parameters V -v, seeing version number, Get Ruby validation in attribute writer methods, Creating new Employee instances , “initialize” does an end-run around our validation , “initialize” does an end-run around our validation using raise method to report errors, Errors—the “emergency stop” button , Our complete Dog class , Using “raise” to report errors values returning in methods, Return values searching within arrays for, Arrays are objects, too! truthy and falsy values, Hashes return “nil” by default understanding blocks and, Blocks have a return value variables about, Variables blocks and, Blocks and variable scope copying same reference to, Aliasing instance about, Designing a class , Too many arguments (again) , Instance variables live as long as the instance does accessing, Your Ruby Toolbox accessing via attribute accessors, Our complete Dog class accessor methods for, Attribute writers and readers in action defined within Sinatra route blocks, Embedding a movie title in our HTML instance methods with, Encapsulation matching attribute accessor names, Instance variables belong to the object, not the class! modules and, Using our comments mixin objects and, Instance variables belong to the object, not the class! outside of instance methods, Attribute writers and readers in action storing data inside of objects using, Too many arguments (again) , Instance variables live as long as the instance does subclasses and, Inheritance to the rescue! , Subclasses keep inherited methods alongside new ones naming, Variables , Method names , Attribute writers and readers , Instance variables belong to the object, not the class! naming with matching attribute accessors, Instance variables belong to the object, not the class! using lowercase letters in, Variables version number, of Ruby, Get Ruby vertical bars (|), denoting block parameters, Block parameters W web apps browsers and, Browsers, requests, servers, and responses complete code for, Our complete app code defining routes, Sinatra routes , Multiple routes in the same Sinatra app displaying data accessing instance variables, Embedding a movie title in our HTML ERB embedding tags, ERB embedding tags output from embedding tags, The ERB output embedding tag using output embedding tag ( < %= %>), The ERB output embedding tag , Pool Puzzle Solution using regular embedding tag ( < % %>), The regular embedding tag handling requests serving HTML, Accessing the HTML from Sinatra setting up routes, Multiple routes in the same Sinatra app installing Sinatra, Installing the Sinatra gem planning, Writing web apps in Ruby , Saving and retrieving form data POST requests about, Saving and retrieving form data converting objects to and from strings, Converting objects to and from strings with YAML displaying objects, An ERB template for an individual movie finding objects in YAML::Store, A system for finding Movies in the YAML::Store finding objects within files, Building HTML links to individual movies loading objects, Loading all movies from the MovieStore managing YAML::Store, A class to manage our YAML::Store posting requests, Our browser can GET the form... saving objects to YAML::Store, Saving objects to a file with YAML::Store setting form attributes, Setting the HTML form to send a POST request testing YAML::Store, Testing the MovieStore resource path of, Resource path sending request to WEBrick library, Your computer is talking to itself setting up, Project directory structure setting up data with HTML forms, Letting users add data with HTML forms with HTML tables, Letting users add data with HTML forms web browsers sending request to WEBrick library, Your computer is talking to itself , Our browser can GET the form... , Building HTML links to individual movies using HTTP requests, Request type web apps and, Browsers, requests, servers, and responses WEBrick library, Your computer is talking to itself , Sinatra routes , Our browser can GET the form... , Building HTML links to individual movies The Well-Grounded Rubyist, 2nd edition (Black), #9 Bundler while loops, Loops , Looping over the items in an array , The “each” method, step-by-step Y YAML library, Converting objects to and from strings with YAML YAML module, Converting objects to and from strings with YAML YAML, converting objects to and from strings with, Converting objects to and from strings with YAML YAML::Store class to manage, A class to manage our YAML::Store finding objects in, A system for finding Movies in the YAML::Store , Finding a Movie in the YAML::Store keys within, Numeric IDs for Movies loading from, Loading all movies from the MovieStore saving objects to file with, Saving objects to a file with YAML::Store testing, Testing the MovieStore year method, Docs for a class that doesn’t exist?! yield keyword, Using the “yield” keyword , The “each” method , Your Ruby Toolbox
..................Content has been hidden....................
You can't read the all page of ebook, please click
here login for view all page.