Learning Ruby - Helion
ISBN: 978-05-965-5532-0
stron: 260, Format: ebook
Data wydania: 2007-05-14
Księgarnia: Helion
Cena książki: 101,15 zł (poprzednio: 117,62 zł)
Oszczędzasz: 14% (-16,47 zł)
You don't have to know everything about a car to drive one, and you don't need to know everything about Ruby to start programming with it. Written for both experienced and new programmers alike, Learning Ruby is a just-get-in-and-drive book -- a hands-on tutorial that offers lots of Ruby programs and lets you know how and why they work, just enough to get you rolling down the road.
Interest in Ruby stems from the popularity of Rails, the web development framework that's attracting new devotees and refugees from Java and PHP. But there are plenty of other uses for this versatile language. The best way to learn is to just try the code! You'll find examples on nearly every page of this book that you can imitate and hack. Briefly, this book:
- Outlines many of the most important features of Ruby
- Demonstrates how to use conditionals, and how to manipulate strings in Ruby. Includes a section on regular expressions
- Describes how to use operators, basic math, functions from the Math module, rational numbers, etc.
- Talks you through Ruby arrays, and demonstrates hashes in detail
- Explains how to process files with Ruby
- Discusses Ruby classes and modules (mixins) in detail, including a brief introduction to object-oriented programming (OOP)
- Introduces processing XML, the Tk toolkit, RubyGems, reflection, RDoc, embedded Ruby, metaprogramming, exception handling, and other topics
- Acquaints you with some of the essentials of Rails, and includes a short Rails tutorial.
Osoby które kupowały "Learning Ruby", wybierały także:
- Learning Java Lambdas 373,75 zł, (29,90 zł -92%)
- Learn Python Programming 299,00 zł, (29,90 zł -90%)
- Building Microservices with Spring 199,33 zł, (29,90 zł -85%)
- Modern C++: Efficient and Scalable Application Development 199,33 zł, (29,90 zł -85%)
- Python: Advanced Guide to Artificial Intelligence 199,33 zł, (29,90 zł -85%)
Spis treści
Learning Ruby eBook -- spis treści
- Learning Ruby
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- Preface
- Who Should Read This Book?
- How This Book Works
- About the Examples
- How This Book Is Organized
- Conventions Used in This Book
- Comments and Questions
- Safari Enabled
- Acknowledgments
- 1. Ruby Basics
- Hello, Matz
- A Very Short Ruby Program
- Shebang!
- Issue a System Command
- Appending a String
- Multiply
- Inserting a Shell Command
- Using a Variable
- Expression Substitution
- Formatting a String
- The eval Method and -e Option
- Getting Input from the Keyboard
- Methods
- The block
- The each Method
- The proc
- XML
- The Class
- The Tk Toolkit
- Editing and Running Ruby in TextMate
- Interactive Ruby
- Resources
- Installing Ruby
- Installing Ruby on Mac OS X Tiger
- Installing Ruby on Windows with the One-Click Installer
- Installing Ruby on Windows with Binaries
- Installing Ruby on Linux
- Permission Denied
- Associating File Types on Windows
- Review Questions
- Hello, Matz
- 2. A Quick Tour of Ruby
- Ruby Is Object-Oriented
- The Object Class and the Kernel Module
- Rubys Reserved Words
- Comments
- Variables
- Local Variables
- Instance Variables
- Class Variables
- Global Variables
- Constants
- Parallel Assignment
- Strings
- Regular Expressions
- Numbers and Operators
- Conditional Statements
- Arrays and Hashes
- Methods
- Return Values
- Method Name Conventions
- Default Arguments
- Variable Arguments
- Aliasing Methods
- Blocks
- The yield Statement
- Procs
- Symbols
- Exception Handling
- Ruby Documentation
- Review Questions
- Ruby Is Object-Oriented
- 3. Conditional Love
- The if Statement
- Using else and elsif
- The Ternary Operator
- The case Statement
- The while Loop
- Give me a break
- unless and until
- The loop Method
- The for loop
- The times Method
- The upto Method
- The downto Method
- Execution Before or After a Program
- Review Questions
- The if Statement
- 4. Strings
- Creating Strings
- General Delimited Strings
- Here Documents
- Concatenating Strings
- Accessing Strings
- Comparing Strings
- Manipulating Strings
- Inserting a String in a String
- Changing All or Part of a String
- The chomp and chop Methods
- The delete Method
- Substitute the Substring
- Turn It Around
- From a String to an Array
- Case Conversion
- Iterating Over a String
- downcase, upcase, and swapcase
- Managing Whitespace, etc.
- Incrementing Strings
- Converting Strings
- Regular Expressions
- 1.9 and Beyond
- Review Questions
- Creating Strings
- 5. Math
- Class Hierarchy and Included Modules
- Converting Numbers
- Basic Math Operations
- Division and Truncation
- Equality, Less Than, or Greater Than
- Abbreviated Assignment Operators
- Operators
- Ranges
- Inquiring About Numbers
- Iterating Through Blocks
- More Math Methods
- Math Functions
- Rational Numbers
- Prime Numbers
- Just for Fun
- Review Questions
- 6. Arrays
- Creating Arrays
- Clear the Deck
- Creating an Array with a Block
- There's an Easier Way
- It Gets Even Easier
- Accessing Elements
- Concatenation
- Set Operations
- Unique Elements
- Blow Your Stack
- Comparing Arrays
- Changing Elements
- As a String
- Using shift and unshift
- Deleting Elements
- Arrays and Blocks
- Sorting Things and About Face
- Multidimensional Arrays
- 1.9 and Beyond
- Other Array Methods
- Review Questions
- Creating Arrays
- 7. Hashes
- Creating Hashes
- Accessing Hashes
- Iterating over Hashes
- Changing Hashes
- Merging Hashes
- Sorting a Hash
- Deleting and Clearing a Hash
- Replacing a Hash
- Converting Hashes to Other Classes
- 1.9 and Beyond
- Other Hash Methods
- Review Questions
- 8. Working with Files
- Directories
- Looking Inside Directories
- The Directory Stream
- Creating a New File
- Opening an Existing File
- ARGV and ARGF
- Opening a URI
- Deleting and Renaming Files
- File Inquiries
- Changing File Modes and Owner
- The IO Class
- Review Questions
- Directories
- 9. Classes
- Defining the Class
- Instance Variables
- Accessors
- Class Variables
- Class Methods
- Singletons
- Inheritance
- Modules
- public, private, or protected
- Review Questions
- 10. More Fun with Ruby
- Formatting Output with sprintf
- Processing XML
- REXML
- Builder
- Date and Time
- The Time Class
- The Date Class
- Calendar forms
- Reflection
- Reflection on Variables and Constants
- Reflection on Methods
- Using Tk
- Metaprogramming
- RubyGems
- Exception Handling
- Creating Documentation with RDoc
- RDoc Basics
- Processing Files with RDoc
- Embedded Ruby
- Review Questions
- 11. A Short Guide to Ruby on Rails
- Where Did Rails Come From
- Why Rails?
- A Full-Stack Framework
- Don't Repeat Yourself
- Convention over Configuration
- I Want My MVC
- Scripts
- Validation
- Ajax
- Migrations
- Console
- Environments and Testing
- Capistrano
- Rake
- What Have Other Folks Done with Rails?
- Hosting Rails
- Installing Rails
- Using RubyGems to install Rails
- Other Installation Information
- Learning Rails
- Ruby Tutorials and Books
- A Brief Tutorial
- Review Questions
- A. Ruby Reference
- Ruby Interpreter
- Ruby's Reserved Words
- Operators
- Escape Characters
- Predefined Variables
- Global Constants
- Regular Expressions
- String Unpack Directives
- Array Pack Directives
- Sprintf Flags and Field Types
- File Tests
- Time Formatting Directives
- RDoc Options
- Rake
- B. Answers to Review Questions
- Chapter 1 Review Questions
- Chapter 2 Review Questions
- Chapter 3 Review Questions
- Chapter 4 Review Questions
- Chapter 5 Review Questions
- Chapter 6 Review Questions
- Chapter 7 Review Questions
- Chapter 8 Review Questions
- Chapter 9 Review Questions
- Chapter 10 Review Questions
- Chapter 11 Review Questions
- Glossary
- Index
- About the Author
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly