×

Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide / Edition 4
     

Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide / Edition 4

by Dave Thomas, Andy Hunt, Chad Fowler

Condition: New

Sold by TodaysBooksToday
Seller since
Seller rating

Average rating: 5.0 Average rating:
(21)

Seller Comments
All orders ship same business day via standard shipping (USPS Media Mail) if received by 4 PM CST. We do not ship to APO/FPO addresses.

Ships from: Richardson, TX
Usually ships in 1-2 business days

 

Overview

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 of the Ruby language. We're proud that throughout its history, we've continued to cover the latest version of Ruby.

Would you like to go from first idea to working code much, much faster? Do you currently spend more time satisfying the compiler instead of your clients or end users? Are you frustrated with demanding languages that seem to get in your way, instead of getting the work done? Are you using Rails, and want to dig deeper into the underlying Ruby language? If so, then we've got a language and book for you!

Ruby is a fully object-oriented language, much like the classic object-oriented language, Smalltalk. Like Smalltalk, it is dynamically typed (as opposed to Java or C++), but unlike Smalltalk, Ruby features the same conveniences found in modern scripting languages such as Perl and Python.

The combination of the power of a pure object-oriented language with the convenience of a scripting language makes Ruby a favorite tool of intelligent, forward-thinking programmers.

The Pickaxe contains four major sections:

An acclaimed tutorial on using Ruby. The definitive reference to the language. Complete documentation of all built-in classes, modules, and methods. Complete descriptions of all 97 standard libraries.

This is the reference manual for Ruby, including a description of all the standard library modules, a complete reference to all built-in classes and modules (including all the new and changed methods introduced by Ruby 1.9, 1.9.2, 1.9.3, and 2.0). It also includes all the new and changed syntax and semantics introduced since Ruby 1.8. Learn about the new parameter passing rules, local variable scoping in blocks, fibers, and the new block declaration syntax, among other exciting new features.

About Ruby 2.0

Ruby 2.0 is a minor update to Ruby 1.9, unlike the more major updates from Ruby 1.8 to Ruby 1.9.

The major language changes in Ruby 2.0 are the addition of keyword arguments and the change to use UTF-8 as the default source file encoding.

There are a number of additions to the standard library, including:

@Enumerator::Lazy@, which adds support for lazy access to potentially infinite lists. Refinements allow you to encapsulate changes to third-party classes, and scope their application to individual source files, preventing your changes from polluting the global application.

You'll also find that Ruby 2 is faster, and has memory management improvements that make it more server-friendly.

All told, there are over 110 sections of the book that have been flagged and cross-linked to indicate 2.0 content.

What You Need

This book assumes you have a basic understanding of object-oriented programming.

In general, Ruby programmers tend to favor the the command line for running their code, and they tend to use text editors rather than IDEs.

* Ruby runs on Windows, Linux, and Macs.

Product Details

ISBN-13:
9781937785499
Publisher:
Pragmatic Programmers, LLC, The
Publication date:
07/03/2013
Edition description:
Fourth Edition
Pages:
888
Sales rank:
892,239
Product dimensions:
7.50(w) x 8.90(h) x 1.50(d)

Table of Contents

Foreword to the Third Edition ix

Preface xi

Road Map xv

Part I Facets of Ruby

1 Getting Started 3

1.1 The Command Prompt 3

1.2 Installing Ruby 5

1.3 Running Ruby 9

1.4 Ruby Documentation: RDoc and ri 11

2 Ruby.new 15

2.1 Ruby Is an Object-Oriented Language 15

2.2 Some Basic Ruby 17

2.3 Arrays and Hashes 20

2.4 Symbols 21

2.5 Control Structures 23

2.6 Regular Expressions 24

2.7 Blocks and Iterators 25

2.8 Reading and 'Riting 27

2.9 Command-Line Arguments 28

2.10 Onward and Upward 28

3 Classes, Objects, and Variables 29

3.1 Objects and Attributes 32

3.2 Classes Working with Other Classes 37

3.3 Access Control 40

3.4 Variables 43

4 Containers, Blocks, and Iterators 45

4.1 Arrays 45

4.2 Hashes 47

4.3 Blocks and Iterators 52

4.4 Containers Everywhere 68

5 Sharing Functionality: Inheritance, Modules, and Mixins 69

5.1 Inheritance and Messages 69

5.2 Modules 73

5.3 Mixins 75

5.4 Iterators and the Enumerable Module 77

5.5 Composing Modules 77

5.6 Inheritance, Mixins, and Design 80

6 Standard Types 83

6.1 Numbers 83

6.2 Strings 86

6.3 Ranges 90

7 Regular Expressions 93

7.1 What Regular Expressions Let You Do 93

7.2 Ruby's Regular Expressions 94

7.3 Digging Deeper 96

7.4 Advanced Regular Expressions 105

8 More About Methods 115

8.1 Defining a Method 115

8.2 Calling a Method 118

9 Expressions 125

9.1 Operator Expressions 126

9.2 Miscellaneous Expressions 127

9.3 Assignment 128

9.4 Conditional Execution 132

9.5 Case Expressions 136

9.6 Loops 138

9.7 Variable Scope, Loops, and Blocks 142

10 Exceptions, catch, and throw 145

10.1 The Exception Class 145

10.2 Handling Exceptions 146

10.3 Raising Exceptions 150

10.4 catch and throw 151

11 Basic Input and Output 153

11.1 What Is an IO Object? 153

11.2 Opening and Closing Files 153

11.3 Reading and Writing Files 154

11.4 Talking to Networks 158

11.5 Parsing HTML 159

12 Fibers, Threads, and Processes 161

12.1 Fibers 161

12.2 Multithreading 163

12.3 Controlling the Thread Scheduler 167

12.4 Mutual Exclusion 167

12.5 Running Multiple Processes 170

13 Unit Testing 175

13.1 The Testing Framework 177

13.2 Structuring Tests 181

13.3 Organizing and Running Tests 183

13.4 RSpec and Shoulda 186

13.5 Test::Unit assertions 193

14 When Trouble Strikes! 195

14.1 Ruby Debugger 195

14.2 Interactive Ruby 196

14.3 Editor Support 197

14.4 But It Doesn't Work! 198

14.5 But Ifs Too Slow! 201

Part II Ruby in Its Setting

15 Ruby and Its World 209

15.1 Command-Line Arguments 209

15.2 Program Termination 214

15.3 Environment Variables 214

15.4 Where Ruby Finds Its Libraries 216

15.5 RubyGems Integration 217

15.6 The Rake Build Tool 222

15.7 Build Environment 224

16 Namespaces, Source Files, and Distribution 225

16.1 Namespaces 225

16.2 Organizing Your Source 226

16.3 Distributing and Installing Your Code 233

17 Character Encoding 239

17.1 Encodings 240

17.2 Source Files 240

17.3 Transcoding 245

17.4 Input and Output Encoding 246

17.5 Default External Encoding 248

17.6 Encoding Compatibility 249

17.7 Default Internal Encoding 250

17.8 Fun with Unicode 251

18 Interactive Ruby Shell 253

18.1 Command Line 253

18.2 Commands 260

19 Documenting Ruby 263

19.1 Adding RDoc to Ruby Code 266

19.2 Adding RDoc to C Extensions 269

19.3 Running RDoc 271

19.4 Ruby source file documented with RDoc 272

19.5 C source file documented with RDoc 274

20 Ruby and the Web 277

20.1 Writing CGI Scripts 277

20.2 Using cgi.rb 277

20.3 Templating Systems 280

20.4 Cookies 284

20.5 Choice of Web Servers 286

20.6 Frameworks 287

21 Ruby and Microsoft Windows 289

21.1 Running Ruby Under Windows 289

21.2 Win32API 289

21.3 Windows Automation 290

Part III Ruby Crystallized

22 The Ruby Language 297

22.1 Source File Encoding 297

22.2 Source Layout 297

22.3 The Basic Types 299

22.4 Names 306

22.5 Variables and Constants 308

22.6 Expressions, Conditionals, and Loops 316

22.7 Method Definition 323

22.8 Invoking a Method 327

22.9 Aliasing 330

22.10 Class Definition 331

22.11 Module Definitions 333

22.12 Access Control 335

22.13 Blocks, Closures, and Proc Objects 335

22.14 Exceptions 339

22.15 catch and throw 341

23 Duck Typing 343

23.1 Classes Aren't Types 344

23.2 Coding like a Duck 348

23.3 Standard Protocols and Coercions 349

23.4 Walk the Walk, Talk the Talk 355

24 Metaprograrruning 357

24.1 Objects and Classes 357

24.2 Singletons 360

24.3 Inheritance and Visibility 365

24.4 Modules and Mixins 366

24.5 Metaprogramrriing Class-Level Macros 372

24.6 Two Other Forms of Class Definition 377

24.7 instance_eval and class_eval 379

24.8 Hook Methods 383

24.9 One Last Example 388

24.10 Top-Level Execution Environment 390

24.11 The Turtle Graphics Program 391

25 Reflection, ObjectSpace, and Distributed Ruby 393

25.1 Looking at Objects 393

25.2 Looking at Classes 394

25.3 Calling Methods Dynamically 396

25.4 System Hooks 398

25.5 Tracing Your Program's Execution 400

25.6 Behind the Curtain: The Ruby VM 402

25.7 Marshaling and Distributed Ruby 403

25.8 Compile Time? Runtime? Anytime! 408

26 Locking Ruby in the Safe 409

26.1 Safe Levels 410

26.2 Tainted Objects 410

26.3 Trusted Objects 411

26.4 Definition of the safe levels 412

Part IV Ruby Library Reference

27 Built-in Classes and Modules 417

28 Standard Library 729

A1 Support 829

A1.1 Web Sites 829

A1.2 Usenet Newsgroup 830

A1.3 Mailing Lists 830

A1.4 Bug Reporting 830

A2 Bibliography 831

Index 833

Customer Reviews

Average Review:

Post to your social network

     

Most Helpful Customer Reviews

See all customer reviews