Programming Ruby 1.9: The Pragmatic Programmers' Guide
by Dave Thomas, with Chad Fowler and Andy Hunt
Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.
This book is the only complete reference for Ruby 1.9, the very latest version of Ruby. (If you’re still using Ruby 1.8, you’ll want to check out the original PickAxe.)
For various technical reasons, the eBook version is a PDF: epub and mobi versions of this title will NOT be available.
Did You Buy the Second Edition of the Original PickAxe from Us?
If you bought the second edition book or PDF from us, we have some significant savings for you. Visit your home page for details.
ISBN: 978-1-93435-608-1
Buy Now
About this Book
Would you like to go from first idea to working code much, much faster? Do you currently spend more time satisfying the compiler instead of your clients or end users? Are you frustrated with demanding languages that seem to get in your way, instead of getting the work done? Are you using Rails, and want to dig deeper into the underlying Ruby language? If so, then we’ve got a language and book for you!
Ruby is a fully object-oriented language, much like the classic object-oriented language, Smalltalk. Like Smalltalk, it is dynamically typed (as opposed to Java or C++), but unlike Smalltalk, Ruby features the same conveniences found in modern scripting languages such as Perl and Python.
The combination of the power of a pure object-oriented language with the convenience of a scripting language makes Ruby a favorite tool of intelligent, forward-thinking programmers.
The Pickaxe contains four major sections:
- An acclaimed tutorial on using Ruby.
- The definitive reference to the language.
- Complete documentation of all built-in classes, modules, and methods.
- Complete descriptions of all 98 standard libraries.
This is the reference manual for Ruby, including a description of all the standard library modules, a complete reference to all built-in classes and modules (including all the new and changed methods introduced by Ruby 1.9). It also includes all the new and changed syntax and semantics introduced since Ruby 1.8. Learn about the new parameter passing rules, local variable scoping in blocks, fibers, and the new block declaration syntax, among other exciting new features.
- The definitive reference manual for Ruby programmers.
- Up-to-date and expanded for Ruby version 1.9.
- Complete documentation of all built-in classes, modules, and methods.
- Complete descriptions of all 98 standard libraries.
Contents and Extracts
- GETTING STARTED
- Installing Ruby
- Running Ruby
- Ruby Documentation: RDoc and ri
- RUBY.NEW
- Ruby Is an Object-Oriented Language
- Some Basic Ruby
- Arrays and Hashes
- Symbols
- Control Structures
- Regular Expressions
- Blocks and Iterators
- Reading and ’Riting
- Onward and Upward
- CLASSES, OBJECTS, AND VARIABLES
- Inheritance and Messages
- Objects and Attributes
- Class Variables and Class Methods
- Access Control
- variables
- CONTAINERS, BLOCKS, AND ITERATORS
- Containers
- Blocks and Iterators
- Containers Everywhere
- STANDARD TYPES
- Numbers
- Strings
- Ranges
- Regular Expressions
- MORE ABOUT METHODS
- Defining a Method
- Calling a Method
- EXPRESSIONS
- Operator Expressions
- Miscellaneous Expressions
- Assignment
- Conditional Execution
- Case Expressions
- Loops
- Variable Scope, Loops, and Blocks
- EXCEPTIONS, CATCH, AND THROW
- The Exception Class
- Handling Exceptions
- Raising Exceptions
- Catch and Throw
- MODULES
- Namespaces
- Mixins
- Iterators and the Enumerable Module
- Composing Modules
- Including Other Files
- BASIC INPUT AND OUTPUT
- What Is an IO Object?
- Opening and Closing Files
- Reading and Writing Files
- Talking to Networks
- FIBERS, THREADS , AND PROCESSES
- Fibers
- Multithreading
- Controlling the Thread Scheduler
- Mutual Exclusion
- Running Multiple Processes
- UNIT TESTING
- Test::Unit Framework
- Structuring Tests
- Organizing and Running Tests
- WHEN TROUBLE STRIKES
- Ruby Debugger
- Interactive Ruby
- Editor Support
- But It Doesn’t Work!
- But It’s Too Slow!
- RUBY AND ITS WORLD
- Command-Line Arguments
- Program Termination
- Environment Variables
- Where Ruby Finds Its Libraries (Regular and Gems)
- Rake Build Tool
- Build Environment
- INTERACTIVE RUBY SHELL
- Command Line
- Configuration
- Commands
- Restrictions
- Extras
- DOCUMENTING RUBY
- Adding RDoc to Ruby Code
- Adding RDoc to C Extensions
- Running RDoc
- Displaying Program Usage
- RUBY AND THE WEB
- Writing CGI Scripts
- Cookies
- Choice of Web Servers
- Frameworks
- RUBY AND MICROSOFT WINDOWS
- Getting Ruby for Windows
- Running Ruby Under Windows
- Win32API
- Windows Automation
- THE RUBY LANGUAGE
- Source Layout
- The Basic Types
- Names
- Variables and Constants
- Expressions
- Method Definition
- Invoking a Method
- Aliasing
- Class Definition
- Module Definitions
- Access Control
- Blocks, Closures, and Proc Objects
- Exceptions
- Catch and Throw
- DUCK TYPING
- Classes Aren’t Types
- Coding like a Duck
- Standard Protocols and Coercions
- Walk the Walk, Talk the Talk
- CLASSES AND OBJECTS
- How Classes and Objects Interact
- Class and Module Definitions
- Top-Level Execution Environment
- Inheritance and Visibility
- Freezing Objects
- LOCKING RUBY IN THE SAFE
- Safe Levels
- Tainted Objects
- REFLECTION, OBJECTSPACE , AND DISTRIBUTED RUBY
- Looking at Objects
- Looking at Classes
- Calling Methods Dynamically
- System Hooks
- Tracing Your Program’s Execution
- Marshaling and Distributed Ruby
- Compile Time? Runtime? Anytime!
- BUILT-IN CLASSES AND MODULES
- Detailed descriptions of all the methods in all built-in classes and modules (with example code)
- STANDARD LIBRARY
- Summary descriptions of all standard libraries distributed with Ruby
- EXTENDING RUBY
- Appendices
- Socket Library
- MKMF Reference
- Support
- Bibliography
- Index
About the Author
Dave Thomas is a cornerstone of the Ruby community, and is personally responsible for many of its innovative directions and initiatives. He and original co-author Andy Hunt are founders of the Pragmatic Programmers and the Pragmatic Bookshelf. Chad Fowler is co-director of Ruby Central, Inc., and remains an active, driving force in the Ruby community.

