You are previewing Ruby Pocket Reference.
O'Reilly logo
Ruby Pocket Reference

Book Description

Although Ruby is an easy language to learn, in the heat of action you may find that you can't remember the correct syntax for a conditional or the name of a method. This handy pocket reference offers brief yet clear explanations of Ruby's core components, from operators to reserved words to data structures to method syntax, highlighting those key features that you'll likely use every day when coding Ruby. Whether you've come to Ruby because of the Rails web development framework --Ruby's killer app -- or simply because it's a relatively clean, powerful and expressive language that's useful for a lot of applications, the Ruby Pocket Reference is organized to help you find what you need quickly. This book not only will get you up to speed on how Ruby works, it provides you with a handy reference you can use anywhere, anytime. In this book, you find essential information on:

  • Reserved words, operators, comments, numbers, variables, ranges, and symbols

  • Predefined variables andglobal constants

  • Conditional statements, method use, classes, and modules (mixins)

  • Lists of methods from the Object, String, Array, and Hash classes and the Kernel module

  • sprintf andtime formatting directories

  • Interactive Ruby (irb) and the Ruby debugger

  • Ruby documentation

You also get information on the RubyGems package utility and Rake, a build tool similar to make.. If you're using Ruby daily and just want the facts-fast-Ruby Pocket Reference is your book.

Table of Contents

  1. Ruby Pocket Reference
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. 1. Ruby Pocket Reference
      1. 1.1. Conventions Used in This Book
      2. 1.2. Comments and Questions
      3. 1.3. Acknowledgments
      4. 1.4. Running Ruby
        1. 1.4.1. Running the Ruby Interpreter
        2. 1.4.2. Using a Shebang Line on Unix/Linux
        3. 1.4.3. Associating File Types on Windows
      5. 1.5. Reserved Words
      6. 1.6. Operators
      7. 1.7. Comments
      8. 1.8. Numbers
      9. 1.9. Variables
        1. 1.9.1. Local Variables
        2. 1.9.2. Instance Variables
        3. 1.9.3. Class Variables
        4. 1.9.4. Global Variables
        5. 1.9.5. Constants
        6. 1.9.6. Parallel Assignment of Variables
      10. 1.10. Symbols
      11. 1.11. Predefined Variables
      12. 1.12. Pseudovariables
      13. 1.13. Global Constants
      14. 1.14. Ranges
      15. 1.15. Methods
        1. 1.15.1. Parentheses
        2. 1.15.2. Return Values
        3. 1.15.3. Method Name Conventions
        4. 1.15.4. Default Arguments
        5. 1.15.5. Variable Arguments
        6. 1.15.6. Aliasing Methods
        7. 1.15.7. Blocks
          1. 1.15.7.1. The yield statement
        8. 1.15.8. Procs
      16. 1.16. Conditional Statements
        1. 1.16.1. The if Statement
          1. 1.16.1.1. Negation
          2. 1.16.1.2. Multiple tests
          3. 1.16.1.3. Statement modifier for if
          4. 1.16.1.4. The else statement
          5. 1.16.1.5. The elsif statement
        2. 1.16.2. The unless Statement
          1. 1.16.2.1. Statement modifier for unless
        3. 1.16.3. The while Statement
          1. 1.16.3.1. Statement modifier for while
        4. 1.16.4. The until Statement
          1. 1.16.4.1. Statement modifier for until
        5. 1.16.5. The case Statement
        6. 1.16.6. The for Loop
        7. 1.16.7. The Ternary Operator
        8. 1.16.8. Executing Code Before or After a Program
      17. 1.17. Classes
        1. 1.17.1. Instance Variables
        2. 1.17.2. Accessors
        3. 1.17.3. Class Variables
        4. 1.17.4. Class Methods
        5. 1.17.5. Singletons
        6. 1.17.6. Inheritance
          1. 1.17.6.1. Load path
        7. 1.17.7. Public, Private, or Protected
        8. 1.17.8. Modules and Mixins
      18. 1.18. Files
        1. 1.18.1. Creating a New File
        2. 1.18.2. Opening an Existing File
        3. 1.18.3. ARGV and ARGF
        4. 1.18.4. Renaming and Deleting Files
        5. 1.18.5. File Inquiries
        6. 1.18.6. File Modes and Ownership
      19. 1.19. The IO Class
      20. 1.20. Exception Handling
        1. 1.20.1. The rescue and ensure Clauses
        2. 1.20.2. The raise Method
        3. 1.20.3. The catch and throw Methods
      21. 1.21. Object Class
        1. 1.21.1. Object Instance Methods
      22. 1.22. Kernel Module
        1. 1.22.1.
          1. 1.22.1.1. Sprintf flags and field types
      23. 1.23. String Class
        1. 1.23.1. Expression Substitution
        2. 1.23.2. General Delimited Strings
        3. 1.23.3. Here Documents
        4. 1.23.4. Escape Characters
        5. 1.23.5. Character Encoding
        6. 1.23.6. Regular Expressions
        7. 1.23.7. String Methods
          1. 1.23.7.1. String class methods
          2. 1.23.7.2. String instance methods
          3. 1.23.7.3. String unpack directives
      24. 1.24. Array Class
        1. 1.24.1. Creating Arrays
        2. 1.24.2. Array Class Methods
        3. 1.24.3. Array Instance Methods
          1. 1.24.3.1. Array pack directives
      25. 1.25. Hash Class
        1. 1.25.1. Creating Hashes
        2. 1.25.2. Hash Class Methods
        3. 1.25.3. Hash Instance Methods
      26. 1.26. Time Formatting Directives
      27. 1.27. Interactive Ruby (irb)
      28. 1.28. Ruby Debugger
      29. 1.29. Ruby Documentation
      30. 1.30. RDoc Options
      31. 1.31. RubyGems
      32. 1.32. Rake
      33. 1.33. Ruby Resources
      34. 1.34. Glossary
    3. About the Author
    4. SPECIAL OFFER: Upgrade this ebook with O’Reilly