Programming Ruby (2nd edition) ppt

833 3.1K 0
Programming Ruby (2nd edition) ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... command to search for Ruby packages # apt-cache search ruby interpreter libapache-mod -ruby - Embedding Ruby in the Apache web server liberb -ruby1 .6 - Tiny eRuby for Ruby 1.6 liberb -ruby1 .8 - Tiny eRuby ruby - An interpreter of object-oriented scripting language Ruby ruby1.7 - Interpreter of object-oriented scripting language Ruby ruby1.8 - Interpreter of object-oriented scripting language Ruby You can install... with its environment Part II, Ruby in Its Setting, investigates this Here you’ll find practical information on using Ruby: using the interpreter options, using irb, documenting your Ruby code, and packaging your Ruby gems so that others can enjoy them You’ll also find tutorials on some common Ruby tasks: using Ruby with the Web, creating GUI applications using Tk, and using Ruby in a Microsoft Windows... utility, as many now support tar-format files) % tar xzf snapshot.tar.gz ruby/ ruby/ bcc32/ ruby/ bcc32/Makefile.sub ruby/ bcc32/README.bcc32 : : : This installs the Ruby source tree in the subdirectory ruby/ In that directory you’ll find a file named README, which explains the installation procedure in detail To summarize, you build Ruby on POSIX-based systems using the same four commands you use for most... :pserver:anonymous@cvs .ruby- lang.org:/src ←֓ login (Logging in to anonymous@cvs .ruby- lang.org) CVS password: ENTER % cvs -z4 -d :pserver:anonymous@cvs .ruby- lang.org:/src ←֓ checkout ruby The complete source code tree, just as the developers last left it, will now be copied to a ruby subdirectory on your machine This command will check out the head of the development tree If you want the Ruby 1.8 branch, add -r ruby_ 1_8... you can find Ruby supfiles on the ruby- lang site at http://cvs .ruby- lang.org/cvsup/ Interactive Ruby One way to run Ruby interactively is simply to type ruby at the shell prompt Here we typed in the single puts expression and an end-of-file character (which is Ctrl+D on our system) This process works, but it’s painful if you make a typo, and you can’t really see what’s going on as you type % ruby puts... and you can run Ruby GUI applications by double-clicking their names in Explorer 2 If your system supports it, you can avoid hard-coding the path to Ruby in the “shebang” line by using #!/usr/bin/env ruby, which will search your path for ruby and then execute it Prepared exclusively for Yeganefar RUBY D OCUMENTATION : RD OC AND RI 7 Ruby Documentation: RDoc and ri As the volume of the Ruby libraries... http://www.rpmfind.net for a suitable Ruby RPM Enter ruby as a search term, and select from the listed version numbers, architectures, and distributions For example, ruby- 1.8.2.i386 is a binary distribution of Ruby 1.8.2 for Intel x86 architectures Prepared exclusively for Yeganefar 2 I NSTALLING RUBY 3 For Debian dpkg-based Linux systems, you can use the apt-get system to find and install Ruby You can use the apt-cache... Part I Facets of Ruby Prepared exclusively for Yeganefar 1 Chapter 1 Getting Started Before we start talking about the Ruby language, it’d be useful if we helped you get Ruby running on your computer That way you can try sample code and experiment on your own as you read along We’ll also show you some different ways to run Ruby Installing Ruby Quite often, you won’t even need to download Ruby It now comes... includes Ruby (although the version of Ruby preinstalled on OS X is normally several minor releases behind the current Ruby version) Try typing ruby -v at a command prompt—you may be pleasantly surprised If you don’t already have Ruby on your system, or if you’d like to upgrade to a newer version, you can install it pretty simply But first, you have a choice to make: go for a binary distribution, or build Ruby. .. reference for the Ruby programming language If you have the first edition, you’ll find that this version is a significant rewrite When Andy and I wrote the first edition, we had to explain the background and appeal of Ruby Among other things, we wrote “When we discovered Ruby, we realized that we’d found what we’d been looking for More than any other language with which we have worked, Ruby stays out of . pages of Programming Ruby, programming in any language other than Ruby will feel like you’re pushing rope.” Mike Clark, Author and Consultant Ruby is sma. y0 w1 h1" alt="" Developers the world over talk about Programming Ruby and the Ruby language. . . Ruby is a wonderf ully powerful and useful language,

Ngày đăng: 06/03/2014, 17:20

Từ khóa liên quan

Mục lục

  • Foreword to the First Edition

  • Foreword to the Second Edition

  • Preface

  • Road Map

  • Part I---Facets of Ruby

    • Getting Started

      • Installing Ruby

      • Running Ruby

      • Ruby Documentation: RDoc and ri

    • Ruby.new

      • Ruby Is an Object-Oriented Language

      • Some Basic Ruby

      • Arrays and Hashes

      • Control Structures

      • Regular Expressions

      • Blocks and Iterators

      • Reading and 'Riting

      • Onward and Upward

    • Classes, Objects, and Variables

      • Inheritance and Messages

      • Objects and Attributes

      • Class Variables and Class Methods

      • Access Control

      • Variables

    • Containers, Blocks, and Iterators

      • Containers

      • Blocks and Iterators

      • Containers Everywhere

    • Standard Types

      • Numbers

      • Strings

      • Ranges

      • Regular Expressions

    • More about Methods

      • Defining a Method

      • Calling a Method

    • Expressions

      • Operator Expressions

      • Miscellaneous Expressions

      • Assignment

      • Conditional Execution

      • Case Expressions

      • Loops

      • Variable Scope, Loops, and Blocks

    • Exceptions, Catch, and Throw

      • The Exception Class

      • Handling Exceptions

      • Raising Exceptions

      • Catch and Throw

    • Modules

      • Namespaces

      • Mixins

      • Iterators and the Enumerable Module

      • Composing Modules

      • Including Other Files

    • Basic Input and Output

      • What Is an IO Object?

      • Opening and Closing Files

      • Reading and Writing Files

      • Talking to Networks

    • Threads and Processes

      • Multithreading

      • Controlling the Thread Scheduler

      • Mutual Exclusion

      • Running Multiple Processes

    • Unit Testing

      • Test::Unit Framework

      • Structuring Tests

      • Organizing and Running Tests

    • When Trouble Strikes

      • Ruby Debugger

      • Interactive Ruby

      • Editor Support

      • But It Doesn't Work!

      • But It's Too Slow!

  • Part II---Ruby in Its Setting

    • Ruby and Its World

      • Command-Line Arguments

      • Program Termination

      • Environment Variables

      • Where Ruby Finds Its Modules

      • Build Environment

    • Interactive Ruby Shell

      • Command Line

      • Configuration

      • Commands

      • Restrictions

      • rtags and xmp

    • Documenting Ruby

      • Adding RDoc to Ruby Code

      • Adding RDoc to C Extensions

      • Running RDoc

      • Displaying Program Usage

    • Package Management with RubyGems

      • Installing RubyGems

      • Installing Application Gems

      • Installing and Using Gem Libraries

      • Creating Your Own Gems

    • Ruby and the Web

      • Writing CGI Scripts

      • Cookies

      • Improving Performance

      • Choice of Web Servers

      • SOAP and Web Services

      • More Information

    • Ruby Tk

      • Simple Tk Application

      • Widgets

      • Binding Events

      • Canvas

      • Scrolling

      • Translating from Perl/Tk Documentation

    • Ruby and Microsoft Windows

      • Getting Ruby for Windows

      • Running Ruby Under Windows

      • Win32API

      • Windows Automation

    • Extending Ruby

      • Your First Extension

      • Ruby Objects in C

      • The Jukebox Extension

      • Memory Allocation

      • Ruby Type System

      • Creating an Extension

      • Embedding a Ruby Interpreter

      • Bridging Ruby to Other Languages

      • Ruby C Language API

  • Part III---Ruby Crystallized

    • The Ruby Language

      • Source Layout

      • The Basic Types

      • Names

      • Variables and Constants

    • Predefined Variables

      • Expressions

    • Boolean Expressions

    • if and unless Expressions

    • case Expressions

    • Loop Constructs

      • Method Definition

      • Invoking a Method

      • Aliasing

      • Class Definition

      • Module Definitions

      • Access Control

      • Blocks, Closures, and Proc Objects

      • Exceptions

      • Catch and Throw

    • Duck Typing

      • Classes Aren't Types

      • Coding like a Duck

      • Standard Protocols and Coercions

      • Walk the Walk, Talk the Talk

    • Classes and Objects

      • How Classes and Objects Interact

      • Class and Module Definitions

      • Top-Level Execution Environment

      • Inheritance and Visibility

      • Freezing Objects

    • Locking Ruby in the Safe

      • Safe Levels

      • Tainted Objects

    • Reflection, ObjectSpace, and Distributed Ruby

      • Looking at Objects

      • Looking at Classes

      • Calling Methods Dynamically

      • System Hooks

      • Tracing Your Program's Execution

      • Marshaling and Distributed Ruby

      • Compile Time? Runtime? Anytime!

  • Part IV---Ruby Library Reference

    • Built-in Classes and Modules

      • Alphabetical Listing

    • Array

    • Bignum

    • Binding

    • Class

    • Comparable

    • Continuation

    • Dir

    • Enumerable

    • Errno

    • Exception

    • FalseClass

    • File

    • File::Stat

    • FileTest

    • Fixnum

    • Float

    • GC

    • Hash

    • Integer

    • IO

    • Kernel

    • Marshal

    • MatchData

    • Math

    • Method

    • Module

    • NilClass

    • Numeric

    • Object

    • ObjectSpace

    • Proc

    • Process

    • Process::GID

    • Process::Status

    • Process::Sys

    • Process::UID

    • Range

    • Regexp

    • Signal

    • String

    • Struct

    • Struct::Tms

    • Symbol

    • Thread

    • ThreadGroup

    • Time

    • TrueClass

    • UnboundMethod

    • Standard Library

    • Abbrev

    • Base64

    • Benchmark

    • BigDecimal

    • CGI

    • CGI::Session

    • Complex

    • CSV

    • Curses

    • Date/DateTime

    • DBM

    • Delegator

    • Digest

    • DL

    • dRuby

    • English

    • Enumerator

    • erb

    • Etc

    • expect

    • Fcntl

    • FileUtils

    • Find

    • Forwardable

    • ftools

    • GDBM

    • Generator

    • GetoptLong

    • GServer

    • Iconv

    • IO/Wait

    • IPAddr

    • jcode

    • Logger

    • Mail

    • mathn

    • Matrix

    • Monitor

    • Mutex

    • Mutex_m

    • Net::FTP

    • Net::HTTP

    • Net::IMAP

    • Net::POP

    • Net::SMTP

    • Net::Telnet

    • NKF

    • Observable

    • open-uri

    • Open3

    • OpenSSL

    • OpenStruct

    • OptionParser

    • ParseDate

    • Pathname

    • PP

    • PrettyPrint

    • Profile

    • Profiler__

    • PStore

    • PTY

    • Rational

    • readbytes

    • Readline

    • Resolv

    • REXML

    • Rinda

    • RSS

    • Scanf

    • SDBM

    • Set

    • Shellwords

    • Singleton

    • SOAP

    • Socket

    • StringIO

    • StringScanner

    • Sync

    • Syslog

    • Tempfile

    • Test::Unit

    • thread

    • ThreadsWait

    • Time

    • Timeout

    • Tk

    • tmpdir

    • Tracer

    • TSort

    • un

    • URI

    • WeakRef

    • WEBrick

    • Win32API

    • WIN32OLE

    • XMLRPC

    • YAML

    • Zlib

  • Part V---Appendixes

    • Socket Library

    • BasicSocket

    • Socket

    • IPSocket

    • TCPSocket

    • SOCKSSocket

    • TCPServer

    • UDPSocket

    • UNIXSocket

    • UNIXServer

    • MKMF Reference

    • mkmf

    • Support

      • Web Sites

      • Download Sites

      • Usenet Newsgroup

      • Mailing Lists

    • Bibliography

    • Index

    • Summary Tables

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan