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 both Ruby 1.9 and Ruby 2.0, the very latest version of Ruby.
2013 marks the 20th anniversary of the Ruby language. We're proud that throughout its history, we've continued to cover the latest version of Ruby.
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 97 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, 1.9.2, 1.9.3, and 2.0). 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.
About Ruby 2.0
Ruby 2.0 is a minor update to Ruby 1.9, unlike the more major updates from Ruby 1.8 to Ruby 1.9.
The major language changes in Ruby 2.0 are the addition of keyword arguments and the change to use UTF-8 as the default source file encoding.
There are a number of additions to the standard library, including:
@Enumerator::[email protected], which adds support for lazy access to potentially infinite lists. Refinements allow you to encapsulate changes to third-party classes, and scope their application to individual source files, preventing your changes from polluting the global application.
You'll also find that Ruby 2 is faster, and has memory management improvements that make it more server-friendly.
All told, there are over 110 sections of the book that have been flagged and cross-linked to indicate 2.0 content.
What You Need
This book assumes you have a basic understanding of object-oriented programming.
In general, Ruby programmers tend to favor the the command line for running their code, and they tend to use text editors rather than IDEs.
* Ruby runs on Windows, Linux, and Macs.
Table of Contents
Part I: Facets of Ruby
Chapter 1. Getting Started
Chapter 2. Ruby.new
Chapter 3. Classes, Objects, and Variables
Chapter 4. Containers, Blocks, and Iterators
Chapter 5. Sharing Functionality: Inheritance, Modules, and Mixins
Chapter 6. Standard Types
Chapter 7. Regular Expressions
Chapter 8. More About Methods
Chapter 9. Expressions
Chapter 10. Exceptions, catch, and throw
Chapter 11. Basic Input and Output
Chapter 12. Fibers, Threads, and Processes
Chapter 13. Unit Testing
Chapter 14. When Trouble Strikes!
Part II: Ruby in Its Setting
Chapter 15. Ruby and Its World
Chapter 16. Namespaces, Source Files, and Distribution
Chapter 17. Character Encoding
Chapter 18. Interactive Ruby Shell
Chapter 19. Documenting Ruby
Chapter 20. Ruby and the Web
Chapter 21. Ruby and Microsoft Windows
Part III: Ruby Crystallized
Chapter 22. The Ruby Language
Chapter 23. Duck Typing
Chapter 24. Metaprogramming
Chapter 25. Reflection, ObjectSpace, and Distributed Ruby
Chapter 26. Locking Ruby in the Safe
Part IV: Ruby Library Reference
Chapter 27. Built-in Classes and Modules
Chapter 28. Standard Library
Appendix A1. Support
Appendix A2. Bibliography