×
思维导图备注
Ruby Programming Language, The - David Flanagan & Yukihiro Matsumoto
首页
收藏书籍
阅读记录
书签管理
我的书签
添加书签
移除书签
SPECIAL OFFER: Upgrade this ebook with O’Reilly
浏览
12
扫码
小字体
中字体
大字体
2022-02-24 01:56:46
请
登录
再阅读
上一篇:
下一篇:
SPECIAL OFFER: Upgrade this ebook with O’Reilly
A Note Regarding Supplemental Files
Preface
Acknowledgments
David Flanagan
Yukihiro Matsumoto
Conventions Used in This Book
Using Code Examples
How to Contact Us
Safari® Enabled
1. Introduction
A Tour of Ruby
Ruby Is Object-Oriented
Blocks and Iterators
Expressions and Operators in Ruby
Methods
Assignment
Punctuation Suffixes and Prefixes
Regexp and Range
Classes and Modules
Ruby Surprises
Try Ruby
The Ruby Interpreter
Displaying Output
Interactive Ruby with irb
Viewing Ruby Documentation with ri
Ruby Package Management with gem
More Ruby Tutorials
Ruby Resources
About This Book
How to Read This Book
A Sudoku Solver in Ruby
2. The Structure and Execution of Ruby Programs
Lexical Structure
Comments
Literals
Punctuation
Identifiers
Keywords
Whitespace
Syntactic Structure
Block Structure in Ruby
File Structure
Program Encoding
Specifying Program Encoding
Source, External, and Internal Encodings
Program Execution
3. Datatypes and Objects
Numbers
Integer Literals
Floating-Point Literals
Arithmetic in Ruby
Binary Floating-Point and Rounding Errors
Text
String Literals
Character Literals
String Operators
Accessing Characters and Substrings
Iterating Strings
String Encodings and Multibyte Characters
Arrays
Hashes
Hash Literals
Hash Codes, Equality, and Mutable Keys
Ranges
Testing Membership in a Range
Symbols
True, False, and Nil
Objects
Object References
Object Lifetime
Object Identity
Object Class and Object Type
Object Equality
Object Order
Object Conversion
Copying Objects
Marshaling Objects
Freezing Objects
Tainted and Untrusted Objects
4. Expressions and Operators
Literals and Keyword Literals
Variable References
Uninitialized Variables
Constant References
Method Invocations
Assignments
Assigning to Variables
Assigning to Constants
Assigning to Attributes and Array Elements
Abbreviated Assignment
Parallel Assignment
Operators
Unary + and –
Exponentiation: **
Arithmetic: +, –, *, /, and %
Shift and Append: << and >>
Complement, Union, Intersection: ~, &, |, and ^
Comparison: <, <=, >, >=, and <=>
Equality: ==, !=, =~, !~, and ===
Boolean Operators: &&, ||, !, and, or, not
Ranges and Flip-Flops: .. and ...
Conditional: ?:
Assignment Operators
The defined? Operator
Statement Modifiers
Nonoperators
5. Statements and Control Structures
Conditionals
if
if As a Modifier
unless
case
The ?: Operator
Loops
while and until
while and until As Modifiers
The for/in Loop
Iterators and Enumerable Objects
Numeric Iterators
Enumerable Objects
Writing Custom Iterators
Enumerators
External Iterators
Iteration and Concurrent Modification
Blocks
Block Syntax
The Value of a Block
Blocks and Variable Scope
Passing Arguments to a Block
Block Parameters in Ruby 1.9
Altering Control Flow
return
break
next
redo
retry
throw and catch
Exceptions and Exception Handling
Exception Classes and Exception Objects
Raising Exceptions with raise
Handling Exceptions with rescue
The else Clause
The ensure Clause
rescue with Method, Class, and Module Definitions
rescue As a Statement Modifier
BEGIN and END
Threads, Fibers, and Continuations
Threads for Concurrency
Fibers for Coroutines
Continuations
6. Methods, Procs, Lambdas, and Closures
Defining Simple Methods
Method Return Value
Methods and Exception Handling
Invoking a Method on an Object
Defining Singleton Methods
Undefining Methods
Method Names
Operator Methods
Method Aliases
Methods and Parentheses
Optional Parentheses
Required Parentheses
Method Arguments
Parameter Defaults
Variable-Length Argument Lists and Arrays
Mapping Arguments to Parameters
Hashes for Named Arguments
Block Arguments
Procs and Lambdas
Creating Procs
Invoking Procs and Lambdas
The Arity of a Proc
Proc Equality
How Lambdas Differ from Procs
Closures
Closures and Shared Variables
Closures and Bindings
Method Objects
Unbound Method Objects
Functional Programming
Applying a Function to an Enumerable
Composing Functions
Partially Applying Functions
Memoizing Functions
Symbols, Methods, and Procs
7. Classes and Modules
Defining a Simple Class
Creating the Class
Instantiating a Point
Initializing a Point
Defining a to_s Method
Accessors and Attributes
Defining Operators
Array and Hash Access with [ ]
Enumerating Coordinates
Point Equality
Ordering Points
A Mutable Point
Quick and Easy Mutable Classes
A Class Method
Constants
Class Variables
Class Instance Variables
Method Visibility: Public, Protected, Private
Subclassing and Inheritance
Inheriting Methods
Overriding Methods
Augmenting Behavior by Chaining
Inheritance of Class Methods
Inheritance and Instance Variables
Inheritance and Class Variables
Inheritance of Constants
Object Creation and Initialization
new, allocate, and initialize
Factory Methods
dup, clone, and initialize_copy
marshal_dump and marshal_load
The Singleton Pattern
Modules
Modules as Namespaces
Modules As Mixins
Includable Namespace Modules
Loading and Requiring Modules
The Load Path
Executing Loaded Code
Autoloading Modules
Singleton Methods and the Eigenclass
Method Lookup
Class Method Lookup
Constant Lookup
8. Reflection and Metaprogramming
Types, Classes, and Modules
Ancestry and Modules
Defining Classes and Modules
Evaluating Strings and Blocks
Bindings and eval
instance_eval and class_eval
instance_exec and class_exec
Variables and Constants
Querying, Setting, and Testing Variables
Methods
Listing and Testing For Methods
Obtaining Method Objects
Invoking Methods
Defining, Undefining, and Aliasing Methods
Handling Undefined Methods
Setting Method Visibility
Hooks
Tracing
ObjectSpace and GC
Custom Control Structures
Delaying and Repeating Execution: after and every
Thread Safety with Synchronized Blocks
Missing Methods and Missing Constants
Unicode Codepoint Constants with const_missing
Tracing Method Invocations with method_missing
Synchronized Objects by Delegation
Dynamically Creating Methods
Defining Methods with class_eval
Defining Methods with define_method
Alias Chaining
Tracing Files Loaded and Classes Defined
Chaining Methods for Thread Safety
Chaining Methods for Tracing
Domain-Specific Languages
Simple XML Output with method_missing
Validated XML Output with Method Generation
9. The Ruby Platform
Strings
Formatting Text
Packing and Unpacking Binary Strings
Strings and Encodings
Regular Expressions
Regexp Literals
Regexp Factory Methods
Regular Expression Syntax
Pattern Matching with Regular Expressions
Numbers and Math
Numeric Methods
The Math Module
Decimal Arithmetic
Complex Numbers
Rational Numbers
Vectors and Matrices
Random Numbers
Dates and Times
Collections
Enumerable Objects
Arrays
Hashes
Sets
Files and Directories
File and Directory Names
Listing Directories
Testing Files
Creating, Deleting, and Renaming Files and Directories
Input/Output
Opening Streams
Streams and Encodings
Reading from a Stream
Writing to a Stream
Random Access Methods
Closing, Flushing, and Testing Streams
Networking
A Very Simple Client
A Very Simple Server
Datagrams
A More Complex Client
A Multiplexing Server
Fetching Web Pages
Threads and Concurrency
Thread Lifecycle
Threads and Variables
Thread Scheduling
Thread States
Listing Threads and Thread Groups
Threading Examples
Thread Exclusion and Deadlock
Queue and SizedQueue
Condition Variables and Queues
10. The Ruby Environment
Invoking the Ruby Interpreter
Common Options
Warnings and Information Options
Encoding Options
Text Processing Options
Miscellaneous Options
The Top-Level Environment
Predefined Modules and Classes
Top-Level Constants
Global Variables
Predefined Global Functions
User-Defined Global Functions
Practical Extraction and Reporting Shortcuts
Input Functions
Deprecated Extraction Functions
Reporting Functions
One-Line Script Shortcuts
Calling the OS
Invoking OS Commands
Forking and Processes
Trapping Signals
Terminating Programs
Security
Tainted Data
Restricted Execution and Safe Levels
Index
SPECIAL OFFER: Upgrade this ebook with O’Reilly
暂无相关搜索结果!
×
二维码
手机扫一扫,轻松掌上学
×
《Ruby Programming Language, The - David Flanagan & Yukihiro Matsumoto》电子书下载
请下载您需要的格式的电子书,随时随地,享受学习的乐趣!
EPUB 电子书
×
书签列表
×
阅读记录
阅读进度:
0.00%
(
0/0
)
重置阅读进度