Table of Contents – Ruby in Practice

Table of Contents

Copyright

Brief Table of Contents

Table of Contents

List of Figures

List of Tables

List of Examples

Preface

Acknowledgments

About this Book

1. Ruby techniques

Chapter 1. Ruby under the microscope

1.1. Why Ruby now?

1.1.1. Optimizing developer cycles

1.1.2. Language features

1.2. Ruby by example

1.3. Facets of Ruby

1.3.1. Duck typing

1.3.2. Simplicity

1.3.3. DRY efficiency

1.3.4. Functional programming

1.4. Metaprogramming

1.4.1. Getting started with metaprogramming

1.4.2. Domain-specific languages

1.4.3. Refining your metaprogramming

1.5. Summary

Chapter 2. Testing Ruby

2.1. Testing principles

2.1.1. Why bother with testing?

2.1.2. Types of testing

2.1.3. Testing workflow

2.2. Test-driven development with Ruby

2.3. Behavior-driven development with RSpec

2.3.1. What is behavior-driven development?

2.3.2. Testing with RSpec

2.4. A testing environment

2.4.1. Setting up a baseline with fixture data

2.4.2. Faking components with stubs

2.4.3. Setting behavior expectations with mock objects

2.5. Testing your tests

2.5.1. Testing code coverage

2.5.2. Testing quality with Heckle

2.6. Summary

Chapter 3. Scripting with Ruby

3.1. Scripting with Ruby

. Problem

. Solution

. Discussion

3.2. Automating with OLE and OSA

3.2.1. Automating Outlook with Ruby

3.2.2. Automating iCal with Ruby

3.3. Using Rake

3.3.1. Using tasks

3.3.2. File tasks

3.4. Summary

2. Integration and communication

Chapter 4. Ruby on Rails techniques

4.1. Extending Rails

4.1.1. Using helpers to expose Ruby libraries

4.1.2. Metaprogramming away duplication

4.1.3. Turning your code into reusable components

4.2. Rails performance

4.2.1. Benchmarking a Rails application

4.2.2. Profiling a Rails application

4.3. Summary

Chapter 5. Web services

5.1. Using HTTP

5.1.1. HTTP GET

5.1.2. HTTP POST

5.1.3. Serving HTTP requests

5.2. REST with Rails

5.2.1. RESTful resources

5.2.2. Serving XML, JSON, and Atom

5.2.3. Using ActiveResource

5.3. SOAP services

5.3.1. Implementing the service

5.3.2. Invoking the service

5.4. Summary

Chapter 6. Automating communication

6.1. Automating email

6.1.1. Automating sending email

6.1.2. Receiving email

6.1.3. Processing email

6.2. Automating instant communication

6.2.1. Sending messages with AIM

6.2.2. Automating Jabber

6.3. Summary

Chapter 7. Asynchronous messaging

7.1. Open source messaging servers

7.1.1. Using ActiveMQ

7.1.2. Using reliable-msg

7.2. WebSphere MQ

7.2.1. Queuing messages

7.2.2. Processing messages

7.3. Summary

Chapter 8. Deployment

8.1. Creating deployable packages with RubyGems

8.1.1. Using RubyGems in your organization

8.1.2. Setting up a RubyGems repository

8.2. Deploying web applications

8.2.1. Simplifying deployment with Capistrano

8.2.2. Tailing remote logs with Capistrano

8.2.3. Deploying with Vlad the Deployer

8.3. Monitoring with God.rb

8.3.1. A typical God setup

8.3.2. Notifications

8.4. Summary

3. Data and document techniques

Chapter 9. Database facilities and techniques

9.1. Using plain-text files for data persistence

. Problem

. Solution

. Discussion

9.2. Using the (g)dbm API

. Problem

. Solution

. Discussion

9.3. The MySQL driver

. Problem

. Solution

. Discussion

9.4. Using DBI

. Problem

. Solution

. Discussion

9.5. Summary

Chapter 10. Structured documents

10.1. XML in practice

10.1.1. Using XML to read configuration files

10.1.2. Writing configuration data to disk

10.2. Parsing HTML and XHTML with Hpricot

10.2.1. Post-processing HTML output

10.2.2. Reading broken HTML

10.3. Writing configuration data: revisited

. Problem

. Solution

. Discussion

10.4. Reading RSS feeds

. Problem

. Solution

. Discussion

10.5. Creating your own feed

. Problem

. Solution

. Discussion

10.6. Using YAML for data storage

. Problem

. Solution

. Discussion

10.7. Summary

Chapter 11. Identity and authentication

11.1. Securely storing a password

. Problem

. Solution

. Discussion

11.1.1. Authenticating against LDAP

11.2. Authenticating against Active Directory

. Problem

. Solution

. Discussion

11.3. Adding authentication to your Rails application

. Problem

. Solution

. Discussion

11.4. Semi-private, personalized feeds

. Problem

. Solution

. Discussion

11.5. HTTP Basic Authentication

. Problem

. Solution

. Discussion

11.6. Integrating OpenID into your application

. Problem

. Solution

. Discussion

11.7. Summary

Chapter 12. Searching and indexing

12.1. The principles of searching

12.2. Standalone and high-performance searching

12.2.1. Standalone indexing and search with Ferret

12.2.2. Integrating with the Solr search engine

12.2.3. Ultrafast indexing and searching with FTSearch

12.2.4. Indexing and searching Rails data with Ferret and Solr

12.2.5. Searching in Rails with Ultrasphinx

12.3. Integrating search with other technologies

12.3.1. Web search using a basic API (Yahoo!)

12.3.2. Web search using a scraping technique (Google)

12.4. Summary

Chapter 13. Document processing and reporting

13.1. Processing CSV data

. Problem

. Solution

. Discussion

13.2. Generating and emailing daily reports

. Problem

. Solution

. Discussion

13.3. Comparing text reports to well-formed data

. Problem

. Solution

. Discussion

13.4. Creating customized documents for printing

. Problem

. Solution

. Discussion

13.5. Reporting against large datasets

. Problem

. Solution

. Discussion

13.6. Summary