Chapter 1. Ruby under the microscope
Listing 1.1. SQL for graph example database
Listing 1.2. Setting up our database with ActiveRecord
Listing 1.3. Generating a graph with Scruffy
Listing 1.4. Using blocks to reduce code duplication
Listing 1.5. A small example of DRY syntax
Listing 1.6. Map is one way Ruby uses functional programming for parallelism
Listing 1.7. Using attr_accessor to define accessor methods on your class
Listing 1.8. A reimplementation of attr_accessor
Listing 1.9. Using ActsAsTaggable to get a lot of features in one line of code
Listing 1.10. Building an RSS feed for our projects
Listing 1.11. A simplified look at XML::Builder’s use of method_missing
Listing 1.12. A validation domain-specific language example
Chapter 2. Testing Ruby
Listing 2.1. A simple test using Test::Unit
Listing 2.2. Using setup and teardown to prepare tests
Listing 2.3. Tests for our to-be-implemented XML reporter
Listing 2.4. Our PayrollReporter implemented
Listing 2.5. A context for an empty queue string
Listing 2.6. A few specs for a string object
Listing 2.7. A basic spec for our IntranetReader class
Listing 2.8. Our implementation of IntranetReader
Listing 2.9. A process checker class and test
Listing 2.10. A revised test with fixture data
Listing 2.11. Our refactored and expanded tests
Listing 2.12. Building tests for our supplier class
Listing 2.13. A class for handling purchasing from a supplier
Listing 2.14. A stubbed SupplierInterface
Listing 2.15. Tests for shipping components