Eloquent Ruby
Publisher: Addison-Wesley
Published: February 21, 2011
Language: eng
Format: Paperback
Number of pages: 413
ISBN-13: 9780321584106
Table of contents: label: Foreword
title: xix; label: Preface
title: xxi; label: Acknowledgments
title: xxv; label: About the Author
title: xxvii; label: Part I
title: The Basics
pagenum: 1; label: Chapter 1
title: Write Code That Looks Like Ruby
pagenum: 3; label: The Very Basic Basics
title: 4; label: Go Easy on the Comments
title: 6; label: Camels for Classes, Snakes Everywhere Else
title: 8; label: Parentheses Are Optional but Are Occasionally Forbidden
title: 9; label: Folding Up Those Lines
title: 10; label: Folding Up Those Code Blocks
title: 11; label: Staying Out of Trouble
title: 12; label: In the Wild
title: 13; label: Wrapping Up
title: 15; label: Chapter 2: Choose the Right Control Structure
title: 17; label: If, Unless, While, and Until
title: 17; label: Use the Modifier Forms Where Appropriate
title: 19; label: Use each, Not for
title: 20; label: A Case of Programming Logic
title: 21; label: Staying Out of Trouble
title: 23; label: In the Wild
title: 25; label: Wrapping Up
title: 27; label: Chapter 3: Take Advantage of Ruby’s Smart Collections
title: 29; label: Literal Shortcuts
title: 29; label: Instant Arrays and Hashes from Method Calls
title: 30; label: Running Through Your Collection
title: 33; label: Beware the Bang!
title: 36; label: Rely on the Order of Your Hashes
title: 38; label: In the Wild
title: 38; label: Staying Out of Trouble
title: 40; label: Wrapping Up
title: 42; label: Chapter 4: Take Advantage of Ruby’s Smart Strings
title: 43; label: Coming Up with a String
title: 44; label: Another API to Master
title: 47; label: The String: A Place for Your Lines, Characters, and Bytes
title: 49; label: In the Wild
title: 50; label: Staying Out of Trouble
title: 51; label: Wrapping Up
title: 52; label: Chapter 5: Find the Right String with Regular Expressions
title: 53; label: Matching One Character at a Time
title: 54; label: Sets, Ranges, and Alternatives
title: 55; label: The Regular Expression Star
title: 57; label: Regular Expressions in Ruby
title: 58; label: Beginnings and Endings
title: 60; label: In the Wild
title: 62; label: Staying Out of Trouble
title: 63; label: Wrapping Up
title: 64; label: Chapter 6: Use Symbols to Stand for Something
title: 65; label: The Two Faces of Strings
title: 65; label: Not Quite a String
title: 66; label: Optimized to Stand for Something
title: 67; label: In the Wild
title: 69; label: Staying Out of Trouble
title: 70; label: Wrapping Up
title: 71; label: Chapter 7: Treat Everything Like an Object–Because Everything Is
title: 73; label: A Quick Review of Classes, Instances, and Methods
title: 74; label: Objects All the Way Down
title: 76; label: The Importance of Being an Object
title: 77; label: Public, Private, and Protected
title: 79; label: In the Wild
title: 81; label: Staying Out of Trouble
title: 82; label: Wrapping Up
title: 84; label: Chapter 8: Embrace Dynamic Typing
title: 85; label: Shorter Programs, But Not the Way You Think
title: 85; label: Extreme Decoupling
title: 89; label: Required Ceremony Versus Programmer-Driven Clarity
title: 92; label: Staying Out of Trouble
title: 93; label: In the Wild
title: 94; label: Wrapping Up
title: 96; label: Chapter 9: Write Specs!
title: 97; label: Test::Unit: When Your Documents Just Have to Work
title: 98; label: A Plethora of Assertions
title: 101; label: Don’t Test It, Spec It!
title: 101; label: A Tidy Spec Is a Readable Spec
title: 104; label: Easy Stubs
title: 105; label: . . . And Easy Mocks
title: 107; label: In the Wild
title: 108; label: Staying Out of Trouble
title: 110; label: Wrapping Up
title: 113; label: PART II: Classes, Modules, and Blocks
title: 115; label: Chapter 10: Construct Your Classes from Short, Focused Methods
title: 117; label: Compressing Specifications
title: 117; label: Composing Methods for Humans
title: 121; label: Composing Ruby Methods
title: 122; label: One Way Out?
title: 123; label: Staying Out of Trouble
title: 126; label: In the Wild
title: 127; label: Wrapping Up
title: 128; label: Chapter 11: Define Operators Respectfully
title: 129; label: Defining Operators in Ruby
title: 129; label: A Sampling of Operators
title: 131; label: Operating Across Classes
title: 134; label: Staying Out of Trouble
title: 135; label: In the Wild
title: 137; label: Wrapping Up
title: 139; label: Chapter 12: Create Classes That Understand Equality
title: 141; label: An Identifier for Your Documents
title: 141; label: An Embarrassment of Equality
title: 142; label: Double Equals for Everyday Use
title: 143; label: Broadening the Appeal of the == Method
title: 145; label: Well-Behaved Equality
title: 146; label: Triple Equals for Case Statements
title: 149; label: Hash Tables and the eql? Method
title: 150; label: Building a Well-Behaved Hash Key
title: 152; label: Staying Out of Trouble
title: 153; label: In the Wild
title: 154; label: Wrapping Up
title: 156; label: Chapter 13: Get the Behavior You Need with Singleton and Class Methods
title: 157; label: A Stubby Puzzle
title: 158; label: A Hidden, but Real Class
title: 160; label: Class Methods: Singletons in Plain Sight
title: 162; label: In the Wild
title: 164; label: Staying Out of Trouble
title: 165; label: Wrapping Up
title: 167; label: Chapter 14: Use Class Instance Variables
title: 169; label: A Quick Review of Class Variables
title: 169; label: Wandering Variables
title: 171; label: Getting Control of the Data in Your Class
title: 174; label: Class Instance Variables and Subclasses
title: 175; label: Adding Some Convenience to Your Class Instance Variables
title: 176; label: In the Wild
title: 177; label: Staying Out of Trouble
title: 179; label: Wrapping Up
title: 179; label: Chapter 15: Use Modules as Name Spaces
title: 181; label: A Place for Your Stuff, with a Name
title: 181; label: A Home for Those Utility Methods
title: 184; label: Building Modules a Little at a Time
title: 185; label: Treat Modules Like the Objects That They Are
title: 186; label: Staying Out of Trouble
title: 189; label: In the Wild
title: 190; label: Wrapping Up
title: 191; label: Chapter 16: Use Modules as Mixins 193; label: Better Books with Modules 193; label: Mixin Modules to the Rescue
title: 195; label: Extending a Module
title: 197; label: Staying Out of Trouble
title: 198; label: In the Wild
title: 202; label: Wrapping Up
title: 205; label: Chapter 17: Use Blocks to Iterate
title: 207; label: A Quick Review of Code Blocks
title: 207; label: One Word after Another
title: 209; label: As Many Iterators as You Like
title: 210; label: Iterating over the Ethereal
title: 211; label: Enumerable: Your Iterator on Steroids
title: 213; label: Staying Out of Trouble
title: 215; label: In the Wild
title: 217; label: Wrapping Up
title: 218; label: Chapter 18: Execute Around with a Block
title: 219; label: Add a Little Logging
title: 219; label: When It Absolutely Must Happen
title: 224; label: Setting Up Objects with an Initialization Block
title: 225; label: Dragging Your Scope along with the Block
title: 225; label: Carrying the Answers Back
title: 227; label: Staying Out of Trouble
title: 228; label: In the Wild
title: 229; label: Wrapping Up
title: 231; label: Chapter 19: Save Blocks to Execute Later
title: 233; label: Explicit Blocks
title: 233; label: The Call Back Problem
title: 234; label: Banking Blocks
title: 236; label: Saving Code Blocks for Lazy Initialization
title: 237; label: Instant Block Objects
title: 239; label: Staying Out of Trouble
title: 240; label: In the Wild
title: 243; label: Wrapping Up
title: 244; label: PART III: Metaprogramming
title: 247; label: Chapter 20: Use Hooks to Keep Your Program Informed
title: 249; label: Waking Up to a New Subclass
title: 250; label: Modules Want To Be Heard Too
title: 253; label: Knowing When Your Time Is Up
title: 255; label: . . . And a Cast of Thousands
title: 256; label: Staying Out of Trouble
title: 257; label: In the Wild
title: 259; label: Wrapping Up
title: 261; label: Chapter 21: Use method_missing for Flexible Error Handling
title: 263; label: Meeting Those Missing Methods
title: 264; label: Handling Document Errors
title: 266; label: Coping with Constants
title: 267; label: In the Wild
title: 268; label: Staying Out of Trouble
title: 270; label: Wrapping Up
title: 271; label: Chapter 22: Use method_missing for Delegation
title: 273; label: The Promise and Pain of Delegation
title: 274; label: The Trouble with Old-Fashioned Delegation
title: 275; label: The method_missing Method to the Rescue
title: 277; label: More Discriminating Delegation
title: 278; label: Staying Out of Trouble
title: 279; label: In the Wild
title: 281; label: Wrapping Up
title: 283; label: Chapter 23: Use method_missing to Build Flexible APIs
title: 285; label: Building Form Letters One Word at a Time
title: 286; label: Magic Methods from method_missing
title: 287; label: It’s the Users That Count–All of Them
title: 289; label: Staying Out of Trouble
title: 289; label: In the Wild
title: 290; label: Wrapping Up
title: 292; label: Chapter 24: Update Existing Classes with Monkey Patching
title: 293; label: Wide-Open Classes
title: 294; label: Fixing a Broken Class
title: 295; label: Improving Existing Classes
title: 296; label: Renaming Methods with alias_method
title: 297; label: Do Anything to Any Class, Anytime
title: 299; label: In the Wild
title: 299; label: Staying Out of Trouble
title: 303; label: Wrapping Up
title: 303; label: Chapter 25: Create Self-Modifying Classes
title: 305; label: Open Classes, Again
title: 305; label: Put Programming Logic in Your Classes
title: 308; label: Class Methods That Change Their Class
title: 309; label: In the Wild
title: 310; label: Staying Out of Trouble
title: 314; label: Wrapping Up
title: 315; label: Chapter 26: Create Classes That Modify Their Subclasses
title: 317; label: A Document of Paragraphs
title: 317; label: Subclassing Is (Sometimes) Hard to Do
title: 319; label: Class Methods That Build Instance Methods
title: 321; label: Better Method Creation with define_method
title: 324; label: The Modification Sky Is the Limit
title: 324; label: In the Wild
title: 327; label: Staying Out of Trouble
title: 330; label: Wrapping Up
title: 332; label: PART IV: Pulling It All Together
title: 333; label: Chapter 27: Invent Internal DSLs
title: 335; label: Little Languages for Big Problems
title: 335; label: Dealing with XML
title: 336; label: Stepping Over the DSL Line
title: 341; label: Pulling Out All the Stops
title: 344; label: In the Wild
title: 345; label: Staying Out of Trouble
title: 347; label: Wrapping Up
title: 349; label: Chapter 28: Build External DSLs for Flexible Syntax
title: 351; label: The Trouble with the Ripper
title: 352; label: Internal Is Not the Only DSL
title: 353; label: Regular Expressions for Heavier Parsing
title: 356; label: Treetop for Really Big Jobs
title: 358; label: Staying Out of Trouble
title: 360; label: In the Wild
title: 362; label: Wrapping Up
title: 364; label: Chapter 29: Package Your Programs as Gems
title: 367; label: Consuming Gems
title: 367; label: Gem Versions
title: 368; label: The Nuts and Bolts of Gems
title: 369; label: Building a Gem
title: 370; label: Uploading Your Gem to a Repository
title: 374; label: Automating Gem Creation
title: 375; label: In the Wild
title: 376; label: Staying Out of Trouble
title: 377; label: Wrapping Up
title: 380; label: Chapter 30: Know Your Ruby Implementation
title: 381; label: A Fistful of Rubies
title: 381; label: MRI: An Enlightening Experience for the C Programmer
title: 382; label: YARV: MRI with a Byte Code Turbocharger
title: 385; label: JRuby: Bending the “J” in the JVM
title: 387; label: Rubinius
title: 388; label: In the Wild
title: 389; label: Staying Out of Trouble
title: 389; label: Wrapping Up
title: 390; label: Chapter 31: Keep an Open Mind to Go with Those Open Classes
title: 391; label: Appendix: Going Further
title: 393; label: Index
title: 397