
The Book of Ruby
A Hands-On Guide for the Adventurous
No Starch Press
Published on 11. July 2011
400 pages
978-1-59327-400-9 (ISBN)
System requirements
for ePUB without DRM
E-Book Single Licence
You are acquiring a single user licence for this eBook, which you might not transfer. [L]
Available for download
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Ruby is famous for being easy to learn, but most users only scratch the surface of what it can do. While other books focus on Ruby's trendier features, The Book of Ruby reveals the secret inner workings of one of the world's most popular programming languages, teaching you to write clear, maintainable code.
You'll start with the basics—types, data structures, and control flows—and progress to advanced features like blocks, mixins, metaclasses, and beyond. Rather than bog you down with a lot of theory, The Book of Ruby takes a hands-on approach and focuses on making you productive from day one.
As you follow along, you'll learn to:
-Leverage Ruby's succinct and flexible syntax to maximize your productivity
-Balance Ruby's functional, imperative, and object-oriented features
-Write self-modifying programs using dynamic programming techniques
-Create new fibers and threads to manage independent processes concurrently
-Catch and recover from execution errors with robust exception handling
-Develop powerful web applications with the Ruby on Rails framework
Each chapter includes a "Digging Deeper" section that shows you how Ruby works under the hood, so you'll never be caught off guard by its deceptively simple scoping, multithreading features, or precedence rules.
Whether you're new to programming or just new Ruby, The Book of Ruby is your guide to rapid, real-world software development with this unique and elegant language.
More details
Language
English
Place of publication
New York
United States
Product notice
Reflowable
File size
1,23 MB
ISBN-13
978-1-59327-400-9 (9781593274009)
Schweitzer Classification
Other editions
Additional editions

Book
07/2011
1st Edition
No Starch Press
€37.50
Shipment within 3-4 weeks
Persons
Huw Collingbourne is the Director of Technology for SapphireSteel Software, developer of the Ruby In Steel IDE. With 30 years of programming experience, he has written programming columns for numerous magazines, presented features on computing for BBC Television, and currently edits the online technical journal Bitwise Magazine. He has previously released two free ebooks on Ruby?The Little Book of Ruby and The Book of Ruby.
Content
- Intro
- The Book of Ruby
- Acknowledgments
- Introduction
- What Is Ruby?
- What Is Rails?
- Matters of Ruby Style
- How to Read This Book
- Digging Deeper
- Making Sense of the Text
- Downloading Ruby
- Getting the Source Code of the Sample Programs
- Running Ruby Programs
- The Ruby Library Documentation
- 1. Strings, Numbers, Classes, and Objects
- Getting and Putting Input
- Strings and Embedded Evaluation
- Numbers
- Comments
- Testing a Condition: if..then
- Local and Global Variables
- Classes and Objects
- Instance Variables
- Retrieving Data from an Object
- Messages, Methods, and Polymorphism
- Constructors: new and initialize
- Inspecting Objects
- 2. Class Hierarchies, Attributes, and Class Variables
- Superclasses and Subclasses
- Passing Arguments to the Superclass
- Accessor Methods
- Attribute Readers and Writers
- Calling Methods of a Superclass
- Class Variables
- 3. Strings and Ranges
- User-Defined String Delimiters
- Backquotes
- String Handling
- Concatenation
- What About Commas?
- String Assignment
- Indexing into a String
- Removing Newline Characters: chop and chomp
- Format Strings
- Ranges
- Ranges of Strings
- Iterating with a Range
- 4. Arrays and Hashes
- Arrays
- Creating Arrays
- Multidimensional Arrays
- Iterating over Arrays
- Indexing into Arrays
- Copying Arrays
- Testing Arrays for Equality
- Sorting Arrays
- Comparing Values
- Array Methods
- Hashes
- Creating Hashes
- Indexing into a Hash
- Copying a Hash
- Hash Order
- Sorting a Hash
- Hash Methods
- 5. Loops and Iterators
- for Loops
- Blocks and Block Parameters
- Iterating upto and downto
- Multiple Iterator Arguments
- while Loops
- while Modifiers
- Ensuring a while Loop Executes at Least Once
- until Loops
- loop
- 6. Conditional Statements
- if..then..else
- and, or, and not
- Negation
- if..elsif
- unless
- if and unless Modifiers
- Case Statements
- The === Method
- Alternative Case Syntax
- 7. Methods
- Class Methods
- What Are Class Methods For?
- Class Variables
- Ruby Constructors: new or initialize?
- Singleton Methods
- Singleton Classes
- Overriding Methods
- Public, Protected, and Private Methods
- 8. Passing Arguments and Returning Values
- Summarizing Instance, Class, and Singleton Methods
- Returning Values
- Returning Multiple Values
- Default and Multiple Arguments
- Assignment and Parameter Passing
- Integers Are Special
- The One-Way-In, One-Way-Out Principle
- Modifying Receivers and Yielding New Objects
- Potential Side Effects of Reliance on Argument Values
- Parallel Assignment
- 9. Exception Handling
- rescue: Execute Code When Error Occurs
- ensure: Execute Code Whether or Not an Error Occurs
- else: Execute Code When No Error Occurs
- Error Numbers
- retry: Attempt to Execute Code Again After an Error
- raise: Reactivate a Handled Error
- 10. Blocks, Procs, and Lambdas
- What Is a Block?
- Line Breaks Are Significant
- Nameless Functions
- Look Familiar?
- Blocks and Arrays
- Procs and Lambdas
- Block or Hash?
- Creating Objects from Blocks
- What Is a Closure?
- yield
- Blocks Within Blocks
- Passing Named Proc Arguments
- Precedence Rules
- Blocks as Iterators
- 11. Symbols
- Symbols and Strings
- Symbols and Variables
- Why Use Symbols?
- 12. Modules and Mixins
- A Module Is Like a Class . . .
- Module Methods
- Modules as Namespaces
- Included Modules, or "Mixins"
- Name Conflicts
- Alias Methods
- Mix In with Care!
- Including Modules from Files
- 13. Files and IO
- Opening and Closing Files
- Characters and Compatibility
- Files and Directories
- Copying Files
- Directory Inquiries
- A Discursion into Recursion
- Sorting by Size
- 14. YAML
- Converting to YAML
- Nested Sequences
- Saving YAML Data
- Omitting Variables on Saving
- Multiple Documents, One File
- A YAML Database
- Adventures in YAML
- 15. Marshal
- Saving and Loading Data
- Omitting Variables on Saving
- Saving Singletons
- YAML and Singletons
- Marshal and Singletons
- 16. Regular Expressions
- Making Matches
- Match Groups
- MatchData
- Prematch and Postmatch
- Greedy Matching
- String Methods
- File Operations
- 17. Threads
- Creating Threads
- Running Threads
- Going Native
- The Main Thread
- Thread Status
- Ensuring That a Thread Executes
- Thread Priorities
- The Main Thread Priority
- Mutexes
- Fibers
- 18. Debugging and Testing
- IRB: Interactive Ruby
- Debugging
- Unit Testing
- 19. Ruby on Rails
- Installing Rails
- Do It Yourself . . .
- Or Use an "All-in-One" Installer
- Model-View-Controller
- A First Ruby on Rails Application
- Create a Rails Application
- Create a Controller
- Anatomy of a Simple Rails Application
- The Generate Controller Script Summarized
- Create a View
- Rails Tags
- Let's Make a Blog!
- Create the Database
- Creating a MySQL Database
- Scaffolding
- Migration
- Partials
- Test It!
- 20. Dynamic Programming
- Self-Modifying Programs
- eval
- Special Types of eval
- Adding Variables and Methods
- Creating Classes at Runtime
- Bindings
- send
- Removing Methods
- Handling Missing Methods
- Writing Programs at Runtime
- Exploring Further
- A. Documenting Ruby with RDoc
- B. Installing MySQL for Ruby on Rails
- Downloading MySQL
- Installing MySQL
- Configuring MySQL
- Can't Find the Database?
- C. Further Reading
- Books
- Ebooks
- Websites
- D. Ruby and Rails Development Software
- IDEs and Editors
- Web Servers
- Databases
- Ruby Implementations
- Index
- About the Author
- Colophon
- E. Updates
System requirements
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.