ebook img

Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide PDF

1463 Pages·2013·5.12 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide

Programming Ruby 1.9 & 2.0 The Pragmatic Programmers’ Guide by Dave Thomas, with Chad Fowler, Andy Hunt Version: P1.0 (June, 2013) Copyright © 2013 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trust— you can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks. —Dave & Andy. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC. Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein. Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com. Table of Contents Foreword to the Third Edition Preface  Why Ruby?  Ruby Versions  Changes in the Book  Resources  Acknowledgments  Notation Conventions Road Map I. Facets of Ruby   1. Getting Started   1.1The Command Prompt   1.2Installing Ruby   1.3Running Ruby   1.4Ruby Documentation: RDoc and ri   2. Ruby.new   2.1Ruby Is an Object-Oriented Language   2.2Some Basic Ruby   2.3Arrays and Hashes   2.4Symbols   2.5Control Structures   2.6Regular Expressions   2.7Blocks and Iterators   2.8Reading and ’Riting   2.9Command-Line Arguments   2.10Onward and Upward   3. Classes, Objects, and Variables 3.1Objects and Attributes   3.2Classes Working with Other Classes   3.3Access Control   3.4Variables   4. Containers, Blocks, and Iterators   4.1Arrays   4.2Hashes   4.3Blocks and Iterators   4.4Containers Everywhere   5. Sharing Functionality: Inheritance, Modules, and Mixins   5.1Inheritance and Messages   5.2Modules   5.3Mixins   5.4Iterators and the Enumerable Module   5.5Composing Modules   5.6Inheritance, Mixins, and Design   6. Standard Types   6.1Numbers   6.2Strings   6.3Ranges   7. Regular Expressions   7.1What Regular Expressions Let You Do   7.2Ruby’s Regular Expressions   7.3Digging Deeper   7.4Advanced Regular Expressions   8. More About Methods   8.1Defining a Method   8.2Calling a Method   9. Expressions   9.1Operator Expressions   9.2Miscellaneous Expressions 9.3Assignment   9.4Conditional Execution   9.5case Expressions   9.6Loops   9.7Variable Scope, Loops, and Blocks   10. Exceptions, catch, and throw   10.1The Exception Class   10.2Handling Exceptions   10.3Raising Exceptions   10.4catch and throw   11. Basic Input and Output   11.1 What Is an IO Object?   11.2 Opening and Closing Files   11.3 Reading and Writing Files   11.4 Talking to Networks   11.5 Parsing HTML   12. Fibers, Threads, and Processes   12.1Fibers   12.2Multithreading   12.3Controlling the Thread Scheduler   12.4Mutual Exclusion   12.5Running Multiple Processes   13. Unit Testing   13.1The Testing Framework   13.2Structuring Tests   13.3Organizing and Running Tests   13.4RSpec and Shoulda   13.5Test::Unit assertions   14. When Trouble Strikes!   14.1Ruby Debugger   14.2Interactive Ruby 14.3Editor Support   14.4But It Doesn’t Work!   14.5But It’s Too Slow! II. Ruby in Its Setting   15. Ruby and Its World   15.1Command-Line Arguments   15.2Program Termination   15.3Environment Variables   15.4Where Ruby Finds Its Libraries   15.5RubyGems Integration   15.6The Rake Build Tool   15.7Build Environment   16. Namespaces, Source Files, and Distribution   16.1Namespaces   16.2Organizing Your Source   16.3Distributing and Installing Your Code   17. Character Encoding   17.1Encodings   17.2Source Files   17.3Transcoding   17.4Input and Output Encoding   17.5Default External Encoding   17.6Encoding Compatibility   17.7Default Internal Encoding   17.8Fun with Unicode   18. Interactive Ruby Shell   18.1Command Line   18.2Commands   19. Documenting Ruby   19.1Adding RDoc to Ruby Code   19.2Adding RDoc to C Extensions 19.3Running RDoc   19.4Ruby source file documented with RDoc   19.5C source file documented with RDoc   20. Ruby and the Web   20.1Writing CGI Scripts   20.2Using cgi.rb   20.3Templating Systems   20.4Cookies   20.5Choice of Web Servers   20.6Frameworks   21. Ruby and Microsoft Windows   21.1Running Ruby Under Windows   21.2Win32API   21.3Windows Automation III. Ruby Crystallized   22. The Ruby Language   22.1Source File Encoding   22.2Source Layout   22.3The Basic Types   22.4Names   22.5Variables and Constants   22.6Expressions, Conditionals, and Loops   22.7Method Definition   22.8Invoking a Method   22.9Aliasing   22.10Class Definition   22.11 Module Definitions   22.12Access Control   22.13Blocks, Closures, and Proc Objects   22.14Exceptions   22.15catch and throw 23. Duck Typing   23.1Classes Aren’t Types   23.2Coding like a Duck   23.3Standard Protocols and Coercions   23.4Walk the Walk, Talk the Talk   24. Metaprogramming   24.1Objects and Classes   24.2Singletons   24.3Inheritance and Visibility   24.4Modules and Mixins   24.5Metaprogramming Class-Level Macros   24.6Two Other Forms of Class Definition   24.7instance_eval and class_eval   24.8Hook Methods   24.9One Last Example   24.10Top-Level Execution Environment   24.11 The Turtle Graphics Program   25. Reflection, ObjectSpace, and Distributed Ruby   25.1Looking at Objects   25.2Looking at Classes   25.3Calling Methods Dynamically   25.4System Hooks   25.5Tracing Your Program’s Execution   25.6Behind the Curtain: The Ruby VM   25.7Marshaling and Distributed Ruby   25.8Compile Time? Runtime? Anytime!   26. Locking Ruby in the Safe   26.1Safe Levels   26.2Tainted Objects   26.3Trusted Objects   26.4Definition of the safe levels IV. Ruby Library Reference   27. Builtin Classes and Modules   28. Standard Library A1. Support  A1.1 Web Sites  A1.2 Usenet Newsgroup  A1.3 Mailing Lists  A1.4 Bug Reporting A2. Bibliography Copyright © 2013, The Pragmatic Bookshelf.

Description:
Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox. This book is the only complete reference for both Ruby 1.9 and Ruby 2.0, the very latest version of Ruby. 2013 marks the 20th anniversary
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.