基本信息
- 原书名:Learning Ruby
- 原出版社: O'Reilly Media, Inc.
- 作者: Michael Fitzgerald
- 丛书名: 东南大学出版社O'REILLY图书系列
- 出版社:东南大学出版社
- ISBN:9787564109639
- 上架时间:2010-11-1
- 出版日期:2007 年11月
- 开本:16开
- 页码:238
- 版次:1-1
- 所属分类:赠品
内容简介
由于网络开发框架Ruby on Rails的流行和大受欢迎,Ruby已经引起了很多Java和PHP开发人员的兴趣。但除了Rails之外,Ruby还有其他广泛的用途,而学习这些用法的最好方法就是动手尝试编写代码。在本书中,几乎每一页都可以找到代码例子。您可以仿照或者改写这些例子,生成您自己的代码。 本书包含以下主题: * 介绍Ruby最重要的功能特性 * 示例说明如何使用条件语句以及如何使用Ruby字符串 * 涵盖正则表达式 * 解释如何使用Ruby的操作符、有理数、算术表达式以及Math模块的函数 * 详细介绍Ruby数组和hash功能 * 讲解使用Ruby进行文件处理 * 对Ruby类和mixin模块的细节展开讨论,包括对面向对象编程的简要介绍 * 介绍XML处理、Tk工具包、RubyGems、反射机制(reflection)、RDoc、嵌入式Ruby、元编程(metaprogramming)、异常处理等内容 * 让您掌握Rails的基本知识,包括一个Rails的简单教程
作译者
目录
1 Ruby Basics
2 A Quick Tour of Ruby
3 Conditional Love
4 Strings
5 Math
6 Arrays
7 Hashes
8 Working with Files
9 Classes
10 More Fun with Ruby
11 A Short Guide to Ruby on Rails
A Ruby Reference
B Answers to Review Questions
Glossary
Index
前言
Who Should Read This Book?
Generally, I figure two kinds of readers will buy this book: experienced programmers who want to learn Ruby, and new programmers who want to learn to program.
I have the interesting job of catering to both while trying not to tick off either. It’s a balancing act, and this is how I’ll handle it: I am going to address you as if you are already a competent programmer, but I’ll also provide plenty of help for beginners, mostly in the form of notes or sidebars. I’ll let you know when you can skip a section if you are already a heavy hitter.
If you’re a fairly experienced programmer, you might just want to read the code examples first, from the beginning of the book to the end, skimming the explanations surrounding the examples as needed. You should be able to see what’s going on fairly quickly just by keeping your eyes on the code. The code is laid out in a more or less logical fashion (to me at least), so you should be able to figure out Ruby in fairly short order. If you are new to programming, I have attempted to make your job a little easier by explaining things as I go along. How This Book Works Do you have to know everything about a car before you start driving? Did you have to know anything about fuel injection, combustion, or timing belts to drive? Of course not. ..
It’s the same with programming in a new language. I am going to show you lots of Ruby programs, many of them just one-liners, and then tell you how and why they work—just enough to get you rolling down the road. I take this approach because I believe we do most of our learning by observing, imitating, and playing. I plan to do a lot of that in this book.
You should know up front that this is a just-get-in-and-drive book. In other words, you can drive a car even if you don’t know whether its got six or eight cylinders. David Heinemeier Hansson, inventor of Ruby on Rails, said something I like: “People learn by changing a little thing, reloading, and seeing the change.” He’s right on.That’s my experience: over the years I have learned more by hacking code than by reading about it.
I also move as quickly as possible, not getting bogged down in the quicksand of details. The details will come in time, as they are needed; the main thing I want to give you now is forward movement and momentum.
If you just follow along with what I’m doing, running the programs and altering them to your taste, you’ll learn quickly. The more you run these programs, the more fluency you’ll develop, and before long, you’ll start thinking and even dreaming in Ruby. Then you’ll just take off on your own.
The latest stable version at the time I am writing this is 1.8.6. That’s the version I’ll be using. You can probably get along using an older version, but unless you have 1.8.6 or later installed, I can’t guarantee that all the programs in this book will work as advertised, though they most likely will. ...