Programming Ruby: the pragmatic programmer's guide

Contents FOREWORD TO THE FIRST EDITION FOREWORD TO THE SECOND EDITION PREFACE ROAD MAP PART I--FACETS OF RUBY 1 GETTING STARTED Installing Ruby Running Ruby Ruby Documentation: RDoc and ri 2 RUBY.NEW Ruby Is an Object-Oriented Language Some Basic Ruby Arrays and Hashes Control Structures Regular Expressions Blocks and Iterators Reading and 'Riting Onward and Upward 3 CLASSES, OBJECTS, AND VARIABLES Inheritance and Messages Objects and Attributes Class Variables and Class Methods Access Control Variables CONTAINERS, BLOCKS, AND ITERATORS Containers Blocks and Iterators Containers Everywhere 5 STANDARD TYPES Numbers Strings Ranges Regular Expressions 6 MORE ABOUT METHODS Defining a Method Calling a Method 7 EXPRESSIONS Operator Expressions Miscellaneous Expressions Assignment Conditional Execution Case Expressions Loops Variable Scope, Loops, and Blocks 8 EXCEPTIONS, CATCH, AND THROW The Exception Class Handling Exceptions Raising Exceptions Catch and Throw 9 MODULES Namespaces Mixins Iterators and the EnumerableModule Composing Modules Including Other Files 10 BASIC INPUT AND OUTPUT What Is an IO Object? Opening and Closing Files Reading and Writing Files Talking to Networks 11 THREADS AND PROCESSES Multithreading Controlling the Thread Scheduler Mutual Exclusion Running Multiple Processes 12 UNIT TESTING Test::Unit Framework Structuring Tests Organizing and Running Tests 13 WHEN TROUBLE STRIKES Ruby Debugger Interactive Ruby Editor Support But It Doesn'tWork! But It's Too Slow! PART II--RUBY IN ITS SETTING 14 RUBY AND ITS WORLD Command-Line Arguments Program Termination Environment Variables Where Ruby Finds Its Modules Build Environment 15 INTERACTIVE RUBY SHELL Command Line Configuration Commands Restrictions rtags and xmp 16 DOCUMENTING RUBY Adding RDoc to Ruby Code Adding RDoc to C Extensions Running RDoc Displaying Program Usage 17 PACKAGE MANAGEMENT WITH RUBYGEMS Installing RubyGems Installing Application Gems Installing and Using Gem Libraries Creating Your Own Gems 18 RUBY AND THE WEB Writing CGI Scripts Cookies Improving Performance Choice of Web Servers SOAP and Web Services More Information 19 RUBY TK Simple Tk Application Widgets Binding Events Canvas Scrolling Translating from Perl/Tk Documentation 20 RUBY AND MICROSOFT WINDOWS Getting Ruby for Windows Running Ruby Under Windows Win32API Windows Automation 21 EXTENDING RUBY Your First Extension Ruby Objects in C The Jukebox Extension Memory Allocation Ruby Type System Creating an Extension Embedding a Ruby Interpreter Bridging Ruby to Other Languages Ruby C Language API PART III--RUBY CRYSTALLIZED 22 THE RUBY LANGUAGE Source Layout The Basic Types Names Variables and Constants Predefined Variables Expressions Boolean Expressions if and unless Expressions case Expressions Loop Constructs Method Definition Invoking a Method Aliasing Class Definition Module Definitions Access Control Blocks, Closures, and Proc Objects Exceptions Catch and Throw 23 DUCK TYPING Classes Aren't Types Coding like a Duck Standard Protocols and Coercions Walk the Walk, Talk the Talk 24 CLASSES AND OBJECTS How Classes and Objects Interact Class and Module Definitions Top-Level Execution Environment Inheritance and Visibility Freezing Objects 25 LOCKING RUBY IN THE SAFE Safe Levels Tainted Objects 26 REFLECTION, OBJECTSPACE, AND DISTRIBUTED RUBY Looking at Objects Looking at Classes Calling Methods Dynamically System Hooks Tracing Your Program's Execution Marshaling and Distributed Ruby Compile Time? Runti