Cover Page....2
About This eBook....3
Title Page....6
Copyright Page....7
Contents....9
Preface....13
About the Author....16
Chapter 1. Hello, World!....17
1.1 Introduction to Ruby....21
1.2 Ruby in a REPL....24
1.3 Ruby in a File....26
1.4 Ruby in a Shell Script....27
1.5 Ruby in a Web Browser....29
Chapter 2. Strings....45
2.1 String Basics....45
2.2 Concatenation and Interpolation....46
2.3 Printing....54
2.4 Attributes, Booleans, and Control Flow....55
2.5 Methods....65
2.6 String Iteration....73
Chapter 3. Arrays....78
3.1 Splitting....78
3.2 Array Access....79
3.3 Array Slicing....81
3.4 More Array Methods....83
3.5 Array Iteration....86
Chapter 4. Other Native Objects....90
4.1 Math....90
4.2 Time....94
4.3 Regular Expressions....100
4.4 Hashes....109
4.5 Application: Unique Words....113
Chapter 5. Functions and Blocks....120
5.1 Function Definitions....120
5.2 Functions in a File....123
5.3 Method Chaining....132
5.4 Blocks....137
Chapter 6. Functional Programming....144
6.1 Map....145
6.2 Select....153
6.3 Reduce....157
Chapter 7. Objects and Classes....169
7.1 Defining Classes....169
7.2 Inheritance....178
7.3 Derived Classes....184
7.4 Modifying Native Objects....191
7.5 Modules....198
Chapter 8. Testing and Test-Driven Development....202
8.1 Testing and Ruby Gem Setup....204
8.2 Initial Test Coverage....209
8.3 Red....218
8.4 Green....224
8.5 Refactor....228
Chapter 9. Shell Scripts....239
9.1 Reading from Files....239
9.2 Reading from URLs....245
9.3 DOM Manipulation at the Command Line....248
Chapter 10. A Live Web Application....259
10.1 Setup....259
10.2 Site Pages....265
10.3 Layouts....274
10.4 Embedded Ruby....289
10.5 Palindrome Detector....302
10.6 Conclusion....327
Code Snippets....328
All You Need to Know, and Nothing You Don't, to Create Ruby Programs, Gems, and Web Apps
Programmers love Ruby for its elegance, power, and flexibility: that's why it was chosen for the Ruby on Rails framework that launched websites from Shopify to Coinbase. You'll love Ruby too, but you don't need to learn "everything" about it, just how to use it efficiently to solve real problems. In Learn Enough Ruby to Be Dangerous, renowned instructor Michael Hartl teaches the concepts, skills, and approaches you need to be professionally productive in both general-purpose programming and beginning web app development.
Even if you're new to programming, Hartl helps you quickly build technical sophistication and master the lore you need to succeed. You'll gain a solid understanding of object-oriented and functional programming, develop and publish a self-contained Ruby package (a gem), and use your gem to build and deploy a dynamic web app with the Sinatra framework. Focused exercises help you internalize what matters, without wasting time on details pros dont care about. Soon, it'll be like you were born knowing this stuff--and you'll be suddenly, seriously dangerous.
Michael Hartl's Learn Enough Series includes books and video courses that focus on the most important parts of each subject, so you don't have to learn everything to get started--you just have to learn enough to be dangerous and solve technical problems yourself.