Foreword xix
Preface xxi
Acknowledgments xxv
About the Author xxvii
PART I: The Basics 1
Chapter 1: Write Code That Looks Like Ruby 3
The Very Basic Basics 4
Go Easy on the Comments 6
Camels for Classes, Snakes Everywhere Else 8
Parentheses Are Optional but Are Occasionally Forbidden 9
Folding Up Those Lines 10
Folding Up Those Code Blocks 11
Staying Out of Trouble 12
In the Wild 13
Wrapping Up 15
Chapter 2: Choose the Right Control Structure 17
If, Unless, While, and Until 17
Use the Modifier Forms Where Appropriate 19
Use each, Not for 20
A Case of Programming Logic 21
Staying Out of Trouble 23
In the Wild 25
Wrapping Up 27
Chapter 3: Take Advantage of Ruby’s Smart Collections 29
Literal Shortcuts 29
Instant Arrays and Hashes from Method Calls 30
Running Through Your Collection 33
Beware the Bang! 36
Rely on the Order of Your Hashes 38
In the Wild 38
Staying Out of Trouble 40
Wrapping Up 42
Chapter 4: Take Advantage of Ruby’s Smart Strings 43
Coming Up with a String 44
Another API to Master 47
The String: A Place for Your Lines, Characters, and Bytes 49
In the Wild 50
Staying Out of Trouble 51
Wrapping Up 52
Russ Olsen’s career spans three decades, during which he has written everything from graphics device drivers to document management applications. These days, he diligently codes GIS, web service security, and process automation solutions. He spends much of his otherwise free time writing and speaking about programming, especially Ruby and Clojure. His first book was the highly regarded Design Patterns In Ruby (Addison-Wesley, 2007). He is also the lurking presence behind the Technology As If People Mattered blog at www.russolsen.com.
R>Eloquent Ruby is like programming in Ruby itself: fun, surprisingly deep, and you'll find yourself wishing it was always done this way. Wherever you are in your Ruby experience from novice to Rails developer, this book is a must read.
![]() |
Ask a Question About this Product More... |
![]() |