Ruby in practice

Free Download

Authors:

ISBN: 1933988479, 9781933988474

Size: 4 MB (3732364 bytes)

Pages: 359/359

File format:

Language:

Publishing Year:

Category:

Jeremy McAnally, Assaf Arkin1933988479, 9781933988474


Table of contents :
Front Cover……Page 1
brief contents……Page 8
contents……Page 10
preface……Page 16
acknowledgments……Page 18
Who should read this book……Page 20
Code conventions……Page 21
About the cover illustration……Page 22
Ruby techniques……Page 24
Ruby under the microscope……Page 26
1.1.1 Optimizing developer cycles……Page 27
1.2 Ruby by example……Page 29
1.3 Facets of Ruby……Page 33
1.3.1 Duck typing……Page 35
1.3.3 DRY efficiency……Page 37
1.3.4 Functional programming……Page 38
1.4 Metaprogramming……Page 39
1.4.1 Getting started with metaprogramming……Page 40
1.4.2 Domain-specific languages……Page 44
1.4.3 Refining your metaprogramming……Page 45
1.5 Summary……Page 47
Testing Ruby……Page 48
2.1.1 Why bother with testing?……Page 49
2.1.2 Types of testing……Page 50
2.1.3 Testing workflow……Page 51
2.2 Test-driven development with Ruby……Page 52
2.3 Behavior-driven development with RSpec……Page 57
2.3.1 What is behavior-driven development?……Page 58
2.3.2 Testing with RSpec……Page 59
2.4.1 Setting up a baseline with fixture data……Page 64
2.4.2 Faking components with stubs……Page 67
2.4.3 Setting behavior expectations with mock objects……Page 69
2.5.1 Testing code coverage……Page 72
2.5.2 Testing quality with Heckle……Page 74
2.6 Summary……Page 76
Scripting with Ruby……Page 77
3.1 Scripting with Ruby……Page 78
3.2.1 Automating Outlook with Ruby……Page 82
3.2.2 Automating iCal with Ruby……Page 84
3.3 Using Rake……Page 87
3.3.1 Using tasks……Page 88
3.3.2 File tasks……Page 92
3.4 Summary……Page 96
Integration and communication……Page 98
4.1 Extending Rails……Page 100
4.1.1 Using helpers to expose Ruby libraries……Page 101
4.1.2 Metaprogramming away duplication……Page 105
4.1.3 Turning your code into reusable components……Page 107
4.2.1 Benchmarking a Rails application……Page 109
4.2.2 Profiling a Rails application……Page 111
4.3 Summary……Page 112
Web services……Page 113
5.1.1 HTTP GET……Page 114
5.1.2 HTTP POST……Page 116
5.1.3 Serving HTTP requests……Page 120
5.2.1 RESTful resources……Page 124
5.2.2 Serving XML, JSON, and Atom……Page 132
5.2.3 Using ActiveResource……Page 137
5.3.1 Implementing the service……Page 140
5.3.2 Invoking the service……Page 146
5.4 Summary……Page 148
Automating communication……Page 149
6.1.1 Automating sending email……Page 150
6.1.2 Receiving email……Page 153
6.1.3 Processing email……Page 155
6.2.1 Sending messages with AIM……Page 157
6.2.2 Automating Jabber……Page 159
6.3 Summary……Page 162
7.1 Open source messaging servers……Page 163
7.1.1 Using ActiveMQ……Page 164
7.1.2 Using reliable-msg……Page 168
7.2.1 Queuing messages……Page 172
7.2.2 Processing messages……Page 178
7.3 Summary……Page 182
Deployment……Page 183
8.1.1 Using RubyGems in your organization……Page 184
8.1.2 Setting up a RubyGems repository……Page 187
8.2.1 Simplifying deployment with Capistrano……Page 190
8.2.2 Tailing remote logs with Capistrano……Page 193
8.2.3 Deploying with Vlad the Deployer……Page 194
8.3.1 A typical God setup……Page 196
8.3.2 Notifications……Page 199
8.4 Summary……Page 201
Data and document techniques……Page 204
Database facilities and techniques……Page 206
9.1 Using plain-text files for data persistence……Page 207
9.2 Using the (g)dbm API……Page 212
9.3 The MySQL driver……Page 220
9.4 Using DBI……Page 227
9.5 Summary……Page 230
Structured documents……Page 231
10.1.1 Using XML to read configuration files……Page 232
10.1.2 Writing configuration data to disk……Page 235
10.2 Parsing HTML and XHTML with Hpricot……Page 237
10.2.1 Post-processing HTML output……Page 238
10.2.2 Reading broken HTML……Page 239
10.3 Writing configuration data: revisited……Page 243
10.4 Reading RSS feeds……Page 244
10.5 Creating your own feed……Page 248
10.6 Using YAML for data storage……Page 253
10.7 Summary……Page 254
Identity and authentication……Page 256
11.1 Securely storing a password……Page 257
11.1.1 Authenticating against LDAP……Page 260
11.2 Authenticating against Active Directory……Page 261
11.3 Adding authentication to your Rails application……Page 263
11.4 Semi-private, personalized feeds……Page 266
11.5 HTTP Basic Authentication……Page 269
11.6 Integrating OpenID into your application……Page 270
11.7 Summary……Page 275
Searching and indexing……Page 276
12.2 Standalone and high-performance searching……Page 277
12.2.1 Standalone indexing and search with Ferret……Page 278
12.2.2 Integrating with the Solr search engine……Page 282
12.2.3 Ultrafast indexing and searching with FTSearch……Page 286
12.2.4 Indexing and searching Rails data with Ferret and Solr……Page 290
12.2.5 Searching in Rails with Ultrasphinx……Page 293
12.3.1 Web search using a basic API (Yahoo!)……Page 296
12.3.2 Web search using a scraping technique (Google)……Page 298
12.4 Summary……Page 300
Document processing and reporting……Page 301
13.1 Processing CSV data……Page 302
13.2 Generating and emailing daily reports……Page 306
13.3 Comparing text reports to well-formed data……Page 312
13.4 Creating customized documents for printing……Page 318
13.5 Reporting against large datasets……Page 324
13.6 Summary……Page 329
A.1 Installing on Windows……Page 330
A.3 Installing on Linux……Page 331
A.4.1 Requiring RubyGems with RUBYOPT……Page 332
A.4.3 Accessing Ruby’s documentation……Page 333
B.1 Installing and using JRuby……Page 335
B.2 JRuby and Ruby side by side……Page 336
B.3 Mixing Ruby and Java……Page 337
B.5 Deploying web applications……Page 338
C.1 An overview of deployment options……Page 339
C.2 Reverse proxying……Page 340
C.3 Setting up Thin……Page 341
C.4 Setting up Apache load balancing……Page 344
C.5 Summary……Page 347
A……Page 348
C……Page 349
F……Page 350
H……Page 351
M……Page 352
O……Page 353
R……Page 354
S……Page 356
W……Page 357
Z……Page 358
Back Cover……Page 359

Reviews

There are no reviews yet.

Be the first to review “Ruby in practice”
Shopping Cart
Scroll to Top