You are previewing Ruby Pocket Reference, 2nd Edition.
O'Reilly logo
Ruby Pocket Reference, 2nd Edition

Book Description

Updated for Ruby 2.2, this handy reference offers brief yet clear explanations of Ruby’s core elements—from operators to blocks to documentation creation—and highlights the key features you may work with every day. Need to know the correct syntax for a conditional? Forgot the name of that String method? This book is organized to help you find the facts fast. This pocket reference is ideal for experienced programmers who are new to Ruby.

Table of Contents

  1. 1. Ruby Pocket Reference
    1. Introduction
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
    7. Running Ruby
      1. Running the Ruby Interpreter
    8. Interactive Ruby (irb)
      1. Using a Shebang Comment on Unix/Linux
      2. Associating File Types on Windows
    9. Ruby’s Keywords
    10. Ruby’s Operators
    11. Comments
    12. Numbers
    13. Variables
      1. Local Variables
      2. Instance Variables
      3. Class Variables
      4. Global Variables
      5. Constants
      6. Parallel Variable Assignment
    14. Symbols
    15. Predefined Global Variables
    16. Keyword Literals
    17. Global Constants
    18. Ranges
    19. Methods
      1. Block Arguments
      2. Return Values
      3. Method Name Conventions
      4. Default Arguments
      5. Variable Arguments
      6. Aliasing Methods
      7. Blocks
      8. Procs
    20. Conditional Statements
      1. Flow Control
      2. The if Statement
      3. The unless Statement
      4. The while Statement
      5. The until Statement
      6. The case Statement
      7. The for Loop
      8. The Conditional Operator
      9. Executing Code Before or After a Program
    21. Classes
      1. Reopening a Ruby Class
      2. Instance Variables
      3. Accessors
      4. Class Variables
      5. Class Methods
      6. Singletons
      7. Inheritance
      8. Abstract Classes
      9. Anonymous Classes
      10. Public, Private, and Protected
      11. Modules and Mixins
    22. Files
      1. Creating a New File
      2. Opening an Existing File
      3. ARGV and ARGF
      4. Renaming and Deleting Files
      5. File Inquiries
      6. File Modes and Ownership
    23. The IO Class
    24. Exception Handling
      1. The rescue and ensure Clauses
      2. The raise Method
      3. The catch and throw Methods
    25. BasicObject Class
      1. BasicObject Public Instance Methods
    26. Object Class
      1. Object Public Instance Methods
    27. Kernel Module
    28. String Class
      1. String Literals
      2. String Concatenation
      3. Expression Substitution
      4. General Delimited Strings
      5. Here Documents
      6. Escape Characters
      7. Character Encoding
      8. Regular Expressions
      9. String Methods
    29. Array Class
      1. Creating Arrays
      2. Array Class Methods
      3. Array Instance Methods
    30. Hash Class
      1. Creating Hashes
      2. Hash Class Methods
      3. Hash Instance Methods
    31. Time Formatting Directives
    32. Ruby Documentation
    33. RubyGems
    34. Rake
    35. Ruby Resources
  2. Glossary
  3. Index