You are previewing Ruby Wizardry.
O'Reilly logo
Ruby Wizardry

Book Description

Ruby Wizardry is a modern day fairy tale that teaches programming skills kids can use.

Table of Contents

  1. Ruby Wizardry: An Introduction to Programming for Kids
  2. Dedication
  3. About the Author
  4. About the Technical Reviewers
  5. Foreword
  6. Acknowledgments
  7. 1. What This Book’s About
    1. Why Learn Programming (and Why Ruby)?
    2. All Adults on Deck: Installing Ruby
      1. Installing on Mac or Linux
      2. Installing on Windows
        1. Using RubyInstaller
    3. Achievement Unlocked: Ruby Installed!
    4. Putting on the Ruby Slippers
    5. Getting to Know IRB
    6. Using a Text Editor and the ruby Command
      1. Mac
      2. Linux
      3. Windows
      4. Creating Your First Script
    7. When to Use IRB and When to Use a Text Editor
    8. The Prompts Used in This Book
    9. Into the Shiny Red Yonder
  8. 2. The King and His String
    1. A Short Yarn
    2. A Bit More About Variables
    3. Ruby Operators
    4. A Smallish Project for You
    5. You Know This!
  9. 3. Pipe Dreams
    1. The Apprentice Plumber’s Dilemma
    2. Writing and Running Ruby Scripts
    3. His Majesty’s Flow Control
    4. Improving flow_rate.rb with Fancier Logical Operators
    5. A Biggerish Project for You
    6. You Know This!
  10. 4. Staying in the Loop
    1. Ruby on Monorails
    2. while Loops
    3. Arrays
    4. Putting Arrays and Loops into Action
    5. Your Project, Should You Choose to Accept It
    6. You Know This!
  11. 5. Array of Sunshine and Hash on the Range
    1. Big Hank’s Hashery
    2. Arrays Within Arrays
    3. Even More Array Methods!
    4. Shift! Pop! Insert!
    5. Iterating with Arrays
    6. Hash in the Hashery
    7. Rollicking Ranges
    8. Order Up!
    9. You Know This!
  12. 6. The (Chunky) Bacon to Ruby’s Hash
    1. Symbols!
    2. The Skinny on Symbols
    3. Symbols and Hashes, Together at Last
    4. The Mid-morning Rush
    5. What Else Can You Do with Symbols?
    6. You Know This!
  13. 7. The Magic of Methods and Blocks
    1. A Method to the Madness
    2. Defining Your Own Methods
      1. return Versus puts
      2. Understanding Method Arguments
    3. What Is nil?
    4. Splat Parameters
    5. Block Methods
    6. Into the Dagron’s Lair
    7. You Know This!
  14. 8. Everything Is an Object (Almost)
    1. The Subject of Our Story Is an Object
    2. Classes and Objects
    3. Creating Our First Class, Minstrel
    4. Variable Scope
      1. These Variable Errors Will Shock and Surprise You!
      2. Global Variables
      3. Class Variables
      4. Instance Variables
      5. Local Variables
    5. Objects and self
    6. Methods and Instance Variables
    7. Dial-a-Ballad, or the Minstrel’s Delivery Service
    8. You Know This!
      1. Objects and Classes
      2. Variables and Scope
      3. Object-Oriented Programming
  15. 9. Inheriting the Magic of Ruby
    1. Her Majesty’s Menagerie
    2. A Brush-up on Classes
      1. A Couple of Classes
      2. Inheritance and DRY Code
    3. Subclass and Superclass
      1. Overriding Methods: Pirates are People, Too
      2. Using super
    4. Protecting the Kingdom with GuardDogs and FlyingMonkeys
      1. Every GuardDog Has His Day
      2. Once More, with Feeling!
    5. The Queen’s Machine
    6. You Know This!
  16. 10. A Horse of a Different Color
    1. Utter Panda-monium
    2. Creating Modules
    3. Constants
    4. Extending Your Knowledge
    5. Mixins and Inheritance
    6. Requiring Another File
    7. Looking Up Constants
    8. A Horse of a Different Color
    9. You Know This!
  17. 11. Second Time’s the Charm
    1. Refactoring at the Refactory
    2. Variable Assignment Tricks
    3. Crystal-Clear Conditionals
    4. When You Need a case Statement
    5. Simplifying Methods
    6. De-duplicating Code
    7. Re-refactoring
    8. You Know This!
  18. 12. Reading, Writing, and Ruby Magic
    1. File Input and Output
    2. Opening a File with Ruby
    3. Writing and Adding to Files
    4. Avoiding Errors While Working with Files
    5. All Loading Docks, Report for Duty!
    6. You Know This!
  19. 13. Follow the WEBrick Road
    1. Ruby and the Internet
    2. Using the open-uri Ruby Gem
    3. Investigating the Kingdom’s Web Server
    4. Beyond the Kingdom Walls
    5. You Know This!
  20. 14. Where to Go Next
    1. The Big Picture: What You Know
    2. Additional Resources and Further Reading
      1. Beginner Books
      2. Intermediate Books
      3. Advanced Books
    3. Online and Multimedia
      1. Railscasts
      2. Ruby5 podcast
      3. Ruby Rogues
      4. Ruby Tapas
      5. Ruby Weekly
      6. Interactive Resources
        1. Codecademy
        2. Code School
        3. Ruby Koans
        4. Ruby Monk
    4. Additional Topics
      1. The Enumerable module
      2. Regular expressions
      3. Procs and lambdas
      4. Information hiding
      5. Handling exceptions
      6. Reflection/metaprogramming
      7. Debugging
      8. Threads and processes
      9. Creating websites
  21. A. Installing Ruby on Mac and Linux
    1. Installing on Mac
    2. Installing on Linux
  22. B. Troubleshooting
    1. Errors Running Ruby Scripts
      1. Command Not Found
      2. No Such File or Directory
    2. Errors Using IRB
      1. Undefined Local Variable or Method
      2. Syntax Error
      3. Can’t Convert nil into String
      4. You Were Saying . . . ?
      5. Clear the Screen
      6. Go Back to a Previous Command
      7. Look It Up!
  23. Updates
    1. More Smart Books for Curious Kids!
  24. Index
  25. Copyright