Information technology - Programming languages - Ruby

ISO/IEC 30170:2012 specifies the syntax and semantics of the computer programming language Ruby, and the requirements for conforming Ruby processors, strictly conforming Ruby programs, and conforming Ruby programs. It does not specify the limit of size or complexity of a program text which a conforming processor evaluates, the minimal requirements of a data processing system that is capable of supporting a conforming processor, the method for activating the execution of programs on a data processing system, and the method for reporting syntactic and runtime errors.

Technologies de l'information — Langages de programmation — Ruby

General Information

Status
Published
Publication Date
11-Apr-2012
Current Stage
9093 - International Standard confirmed
Start Date
29-Apr-2021
Completion Date
30-Oct-2025

Overview

ISO/IEC 30170:2012 - Information technology - Programming languages - Ruby - is the international standard that defines the syntax and semantics of the Ruby programming language. It provides the normative language specification used to describe how Ruby programs are written and how conforming Ruby processors (interpreters or compilers) must behave. The standard also defines the rules for conformance of Ruby processors and programs, while explicitly excluding implementation limits such as program size, minimal hardware requirements, activation methods, and methods for reporting errors.

Key topics and technical requirements

ISO/IEC 30170:2012 covers the formal structure and runtime semantics of Ruby. Major technical topics in the document include:

  • Lexical structure: program text, tokens, identifiers, keywords, string and numeric literals, regular expressions and here-documents.
  • Syntax and grammar: productions, syntactic terms and notational conventions for writing valid Ruby source.
  • Semantics: execution context attributes, evaluation rules, and the meaning of expressions and statements.
  • Fundamental concepts: objects, variables (local, instance, class, global), methods, blocks, classes, singleton classes and modules, inheritance and method lookup.
  • Expressions & statements: method invocation, operator expressions, assignments, control structures, iteration and jump expressions (return, break, next, redo, retry).
  • Scope rules: scoping of local, global and class variables.
  • Exceptions & error handling: causes of exceptions and the specified handling model.
  • Built-in classes and modules: descriptions of core classes, modules, constants and commonly provided instance/singleton methods.
  • Conformance rules: definitions for conforming Ruby processors, strictly conforming Ruby programs, and conforming Ruby programs to enable consistent behavior across implementations.

Note: the standard does not prescribe runtime resource limits, system activation methods, or specific forms of error reporting.

Applications and who uses this standard

ISO/IEC 30170:2012 is primarily used by:

  • Ruby language implementers - authors of interpreters, virtual machines and compilers who need a formal reference for correct behavior and interoperability.
  • Tool and library developers - maintainers of static analyzers, linters, debuggers and language servers that must follow the language specification.
  • Test and conformance bodies - organizations creating compliance suites or certification tests for Ruby processors.
  • Educators and researchers - those teaching language design or studying Ruby’s formal semantics.
  • Enterprise and vendor teams - ensuring portability and predictable behavior of Ruby-based systems.

Related standards

ISO/IEC 30170:2012 complements other ISO/IEC programming-language standards and international best practices for language specification and conformance testing. For implementation or compliance projects, consult this standard as the authoritative specification of Ruby’s syntax and semantics.

Keywords: ISO/IEC 30170, Ruby standard, Ruby syntax and semantics, Ruby processor conformance, programming language specification, Ruby interpreter, Ruby compiler.

Standard

ISO/IEC 30170:2012 - Information technology -- Programming languages -- Ruby

English language
313 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC 30170:2012 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - Programming languages - Ruby". This standard covers: ISO/IEC 30170:2012 specifies the syntax and semantics of the computer programming language Ruby, and the requirements for conforming Ruby processors, strictly conforming Ruby programs, and conforming Ruby programs. It does not specify the limit of size or complexity of a program text which a conforming processor evaluates, the minimal requirements of a data processing system that is capable of supporting a conforming processor, the method for activating the execution of programs on a data processing system, and the method for reporting syntactic and runtime errors.

ISO/IEC 30170:2012 specifies the syntax and semantics of the computer programming language Ruby, and the requirements for conforming Ruby processors, strictly conforming Ruby programs, and conforming Ruby programs. It does not specify the limit of size or complexity of a program text which a conforming processor evaluates, the minimal requirements of a data processing system that is capable of supporting a conforming processor, the method for activating the execution of programs on a data processing system, and the method for reporting syntactic and runtime errors.

ISO/IEC 30170:2012 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.

ISO/IEC 30170:2012 is available in PDF format for immediate download after purchase. The document can be added to your cart and obtained through the secure checkout process. Digital delivery ensures instant access to the complete standard document.

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 30170
First edition
2012-04-15
Information technology — Programming
languages — Ruby
Technologies de l'information — Langages de programmation — Ruby

Reference number
©
ISO/IEC 2012
©  ISO/IEC 2012
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56  CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO/IEC 2012 – All rights reserved

Contents Page
1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
4 Terms and definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
5 Notational conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2.2 Productions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2.3 Syntactic term sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.4 Syntactic terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.2.5 Conceptual names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.3 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.4 Attributes of execution contexts . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 Fundamental concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2.2 Instance variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.3 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.5 Classes, singleton classes, and modules . . . . . . . . . . . . . . . . . . . . . . . 14
6.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.5.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.5.3 Singleton classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.5.4 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.5.5 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.6 Boolean values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7 Execution contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.2 The initial state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
8 Lexical structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
8.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
8.2 Program text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.3 Line terminators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.4 Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8.5 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.6 End-of-program markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.7 Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.7.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.7.2 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.7.3 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.7.4 Punctuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.7.5 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
'ISO/IEC 2012 — All rights reserved iii

8.7.6 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.7.6.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.7.6.2 Numeric literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.7.6.3 String literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.7.6.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 29
8.7.6.3.2 Single quoted strings . . . . . . . . . . . . . . . . . . . . . . . 29
8.7.6.3.3 Double quoted strings . . . . . . . . . . . . . . . . . . . . . . . 30
8.7.6.3.4 Quoted non-expanded literal strings . . . . . . . . . . . . . . . 33
8.7.6.3.5 Quoted expanded literal strings . . . . . . . . . . . . . . . . . 35
8.7.6.3.6 Here documents . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8.7.6.3.7 External command execution . . . . . . . . . . . . . . . . . . . 38
8.7.6.4 Array literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.7.6.5 Regular expression literals . . . . . . . . . . . . . . . . . . . . . . . 42
8.7.6.6 Symbol literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9 Scope of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.2 Scope of local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.3 Scope of global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10 Program structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.1 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.2 Compound statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
11 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11.2 Logical expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11.2.2 Logical NOT expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
11.2.3 Logical AND expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
11.2.4 Logical OR expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
11.3 Method invocation expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
11.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
11.3.2 Method arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
11.3.3 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
11.3.4 The super expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
11.3.5 The yield expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
11.4 Operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
11.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
11.4.2 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
11.4.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
11.4.2.2 Single assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
11.4.2.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 66
11.4.2.2.2 Single variable assignments . . . . . . . . . . . . . . . . . . . . 67
11.4.2.2.3 Scoped constant assignments . . . . . . . . . . . . . . . . . . . 69
11.4.2.2.4 Single indexing assignments. . . . . . . . . . . . . . . . . . . . 69
11.4.2.2.5 Single method assignments . . . . . . . . . . . . . . . . . . . . 70
11.4.2.3 Abbreviated assignments . . . . . . . . . . . . . . . . . . . . . . . . 71
11.4.2.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 71
11.4.2.3.2 Abbreviated variable assignments . . . . . . . . . . . . . . . . 71
11.4.2.3.3 Abbreviated indexing assignments . . . . . . . . . . . . . . . . 72
11.4.2.3.4 Abbreviated method assignments . . . . . . . . . . . . . . . . 73
11.4.2.4 Multiple assignments . . . . . . . . . . . . . . . . . . . . . . . . . . 74
iv'ISO/IEC 2012 — All rights reserved

11.4.2.5 Assignments with rescue modifiers . . . . . . . . . . . . . . . . . . 78
11.4.3 Unary operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 78
11.4.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
11.4.3.2 The defined? expression . . . . . . . . . . . . . . . . . . . . . . . . 79
11.4.4 Binary operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 81
11.5 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.5.2 Control structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.5.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.5.2.2 Conditional expressions . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.5.2.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 85
11.5.2.2.2 The if expression . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.5.2.2.3 The unless expression . . . . . . . . . . . . . . . . . . . . . . 87
11.5.2.2.4 The case expression . . . . . . . . . . . . . . . . . . . . . . . . 87
11.5.2.2.5 Conditional operator expression . . . . . . . . . . . . . . . . . 88
11.5.2.3 Iteration expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
11.5.2.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 89
11.5.2.3.2 The while expression . . . . . . . . . . . . . . . . . . . . . . . 90
11.5.2.3.3 The until expression . . . . . . . . . . . . . . . . . . . . . . . 91
11.5.2.3.4 The for expression . . . . . . . . . . . . . . . . . . . . . . . . 91
11.5.2.4 Jump expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
11.5.2.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 92
11.5.2.4.2 The return expression . . . . . . . . . . . . . . . . . . . . . . 93
11.5.2.4.3 The break expression . . . . . . . . . . . . . . . . . . . . . . . 94
11.5.2.4.4 The next expression . . . . . . . . . . . . . . . . . . . . . . . . 95
11.5.2.4.5 The redo expression . . . . . . . . . . . . . . . . . . . . . . . . 96
11.5.2.4.6 The retry expression . . . . . . . . . . . . . . . . . . . . . . . 97
11.5.2.5 The begin expression . . . . . . . . . . . . . . . . . . . . . . . . . . 97
11.5.3 Grouping expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
11.5.4 Variable references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
11.5.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
11.5.4.2 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
11.5.4.3 Scoped constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
11.5.4.4 Global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
11.5.4.5 Class variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
11.5.4.6 Instance variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
11.5.4.7 Local variables or method invocations . . . . . . . . . . . . . . . . . 102
11.5.4.7.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 102
11.5.4.7.2 Determination of the type of local variable identifiers . . . . . 103
11.5.4.7.3 Local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
11.5.4.7.4 Method invocations . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5.4.8 Pseudo variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5.4.8.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5.4.8.2 The nil expression . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5.4.8.3 The true expression and the false expression . . . . . . . . . 104
11.5.4.8.4 The self expression . . . . . . . . . . . . . . . . . . . . . . . . 105
11.5.5 Object constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
11.5.5.1 Array constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
11.5.5.2 Hash constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
11.5.5.3 Range expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
12 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
12.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
'ISO/IEC 2012 — All rights reserved v

12.2 Expression statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
12.3 The if modifier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
12.4 The unless modifier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
12.5 The while modifier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
12.6 The until modifier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
12.7 The rescue modifier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
13 Classes and modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
13.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
13.1.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
13.1.2 Module definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
13.1.3 Module inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
13.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
13.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
13.2.2 Class definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
13.2.3 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
13.2.4 Instance creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
13.3 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
13.3.1 Method definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
13.3.2 Method parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
13.3.3 Method invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
13.3.4 Method lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
13.3.5 Method visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.3.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.3.5.2 Public methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.3.5.3 Private methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.3.5.4 Protected methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.3.5.5 Visibility change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
13.3.6 The alias statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
13.3.7 The undef statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
13.4 Singleton classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
13.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
13.4.2 Singleton class definition . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
13.4.3 Singleton method definition . . . . . . . . . . . . . . . . . . . . . . . . . . 126
14 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
14.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
14.2 Cause of exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
14.3 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
15 Built-in classes and modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
15.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
15.2 Built-in classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1 Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
15.2.1.5 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.1.5.1 Object#initialize. . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.2 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.2.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
vi'ISO/IEC 2012 — All rights reserved

15.2.2.3 Singleton methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.2.3.1 Module.constants . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2.2.3.2 Module.nesting . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
15.2.2.4 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
15.2.2.4.1 Module#<=> . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
15.2.2.4.2 Module#< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
15.2.2.4.3 Module#<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
15.2.2.4.4 Module#> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
15.2.2.4.5 Module#>= . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
15.2.2.4.6 Module#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
15.2.2.4.7 Module#=== . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
15.2.2.4.8 Module#alias method . . . . . . . . . . . . . . . . . . . . . . . 135
15.2.2.4.9 Module#ancestors . . . . . . . . . . . . . . . . . . . . . . . . . 136
15.2.2.4.10 Module#append features . . . . . . . . . . . . . . . . . . . . . 136
15.2.2.4.11 Module#attr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
15.2.2.4.12 Module#attr accessor . . . . . . . . . . . . . . . . . . . . . . . 137
15.2.2.4.13 Module#attr reader . . . . . . . . . . . . . . . . . . . . . . . . 137
15.2.2.4.14 Module#attr writer . . . . . . . . . . . . . . . . . . . . . . . . 138
15.2.2.4.15 Module#class eval . . . . . . . . . . . . . . . . . . . . . . . . . 138
15.2.2.4.16 Module#class variable defined? . . . . . . . . . . . . . . . . . 139
15.2.2.4.17 Module#class variable get . . . . . . . . . . . . . . . . . . . . 140
15.2.2.4.18 Module#class variable set . . . . . . . . . . . . . . . . . . . . 140
15.2.2.4.19 Module#class variables . . . . . . . . . . . . . . . . . . . . . . 140
15.2.2.4.20 Module#const defined? . . . . . . . . . . . . . . . . . . . . . . 141
15.2.2.4.21 Module#const get . . . . . . . . . . . . . . . . . . . . . . . . . 142
15.2.2.4.22 Module#const missing . . . . . . . . . . . . . . . . . . . . . . 142
15.2.2.4.23 Module#const set . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.2.2.4.24 Module#constants . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.2.2.4.25 Module#extend object . . . . . . . . . . . . . . . . . . . . . . 144
15.2.2.4.26 Module#extended . . . . . . . . . . . . . . . . . . . . . . . . . 144
15.2.2.4.27 Module#include . . . . . . . . . . . . . . . . . . . . . . . . . . 144
15.2.2.4.28 Module#include? . . . . . . . . . . . . . . . . . . . . . . . . . 145
15.2.2.4.29 Module#included . . . . . . . . . . . . . . . . . . . . . . . . . 145
15.2.2.4.30 Module#included modules . . . . . . . . . . . . . . . . . . . . 145
15.2.2.4.31 Module#initialize . . . . . . . . . . . . . . . . . . . . . . . . . 145
15.2.2.4.32 Module#initialize copy . . . . . . . . . . . . . . . . . . . . . . 146
15.2.2.4.33 Module#instance methods . . . . . . . . . . . . . . . . . . . . 147
15.2.2.4.34 Module#method defined? . . . . . . . . . . . . . . . . . . . . . 147
15.2.2.4.35 Module#module eval . . . . . . . . . . . . . . . . . . . . . . . 148
15.2.2.4.36 Module#private . . . . . . . . . . . . . . . . . . . . . . . . . . 148
15.2.2.4.37 Module#protected . . . . . . . . . . . . . . . . . . . . . . . . . 148
15.2.2.4.38 Module#public . . . . . . . . . . . . . . . . . . . . . . . . . . 148
15.2.2.4.39 Module#remove class variable . . . . . . . . . . . . . . . . . . 149
15.2.2.4.40 Module#remove const . . . . . . . . . . . . . . . . . . . . . . . 150
15.2.2.4.41 Module#remove method . . . . . . . . . . . . . . . . . . . . . 150
15.2.2.4.42 Module#undef method . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3.3.1 Class#initialize . . . . . . . . . . . . . . . . . . . . . . . . . . 151
15.2.3.3.2 Class#initialize copy . . . . . . . . . . . . . . . . . . . . . . . 152
'ISO/IEC 2012 — All rights reserved vii

15.2.3.3.3 Class#new . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
15.2.3.3.4 Class#superclass . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4 NilClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4.3.1 NilClass#& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.2.4.3.2 NilClass#| . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.4.3.3 NilClass#ˆ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.4.3.4 NilClass#nil? . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.4.3.5 NilClass#to s . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.5 TrueClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
15.2.5.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.5.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.5.3.1 TrueClass#& . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.5.3.2 TrueClass#| . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.5.3.3 TrueClass#ˆ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.5.3.4 TrueClass#to s . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2.6 FalseClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.3.1 FalseClass#& . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.3.2 FalseClass#| . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.3.3 FalseClass#ˆ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.2.6.3.4 FalseClass#to s . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7 Numeric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.4 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.4.1 Numeric#+@ . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.7.4.2 Numeric#@ . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
15.2.7.4.3 Numeric#abs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
15.2.7.4.4 Numeric#coerce . . . . . . . . . . . . . . . . . . . . . . . . . . 158
15.2.8 Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15.2.8.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15.2.8.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
15.2.8.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
15.2.8.3.1 Integer#<=> . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
15.2.8.3.2 Integer#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
15.2.8.3.3 Integer#+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
15.2.8.3.4 Integer# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
15.2.8.3.5 Integer#* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
15.2.8.3.6 Integer#/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
15.2.8.3.7 Integer#% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
15.2.8.3.8 Integer#˜ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
15.2.8.3.9 Integer#&. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
15.2.8.3.10 Integer#|. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
15.2.8.3.11 Integer#ˆ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
15.2.8.3.12 Integer#<< . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
viii'ISO/IEC 2012 — All rights reserved

15.2.8.3.13 Integer#>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
15.2.8.3.14 Integer#ceil . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
15.2.8.3.15 Integer#downto . . . . . . . . . . . . . . . . . . . . . . . . . . 166
15.2.8.3.16 Integer#eql? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
15.2.8.3.17 Integer#floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
15.2.8.3.18 Integer#hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
15.2.8.3.19 Integer#next . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
15.2.8.3.20 Integer#round . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
15.2.8.3.21 Integer#succ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
15.2.8.3.22 Integer#times . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
15.2.8.3.23 Integer#to f . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
15.2.8.3.24 Integer#to i . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
15.2.8.3.25 Integer#to s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
15.2.8.3.26 Integer#truncate . . . . . . . . . . . . . . . . . . . . . . . . . 169
15.2.8.3.27 Integer#upto . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
15.2.9 Float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
15.2.9.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
15.2.9.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
15.2.9.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
15.2.9.3.1 Float#<=> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
15.2.9.3.2 Float#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
15.2.9.3.3 Float#+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
15.2.9.3.4 Float# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
15.2.9.3.5 Float#*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
15.2.9.3.6 Float#/. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
15.2.9.3.7 Float#% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
15.2.9.3.8 Float#ceil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
15.2.9.3.9 Float#finite? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
15.2.9.3.10 Float#floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
15.2.9.3.11 Float#infinite? . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
15.2.9.3.12 Float#round . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
15.2.9.3.13 Float#to f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
15.2.9.3.14 Float#to i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
15.2.9.3.15 Float#truncate . . . . . . . . . . . . . . . . . . . . . . . . . . 176
15.2.10 String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
15.2.10.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
15.2.10.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
15.2.10.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
15.2.10.4 Upper-case and lower-case characters . . . . . . . . . . . . . . . . . 177
15.2.10.5 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
15.2.10.5.1 String#<=> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
15.2.10.5.2 String#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
15.2.10.5.3 String#=˜ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
15.2.10.5.4 String#+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.2.10.5.5 String#* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.2.10.5.6 String#[] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.2.10.5.7 String#capitalize . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2.10.5.8 String#capitalize! . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2.10.5.9 String#chomp . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2.10.5.10 String#chomp! . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.2.10.5.11 String#chop . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.2.10.5.12 String#chop! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
'ISO/IEC 2012 — All rights reserved ix

15.2.10.5.13 String#downcase . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.2.10.5.14 String#downcase! . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.2.10.5.15 String#each line . . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.2.10.5.16 String#empty? . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.2.10.5.17 String#eql? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.2.10.5.18 String#gsub . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.2.10.5.19 String#gsub! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
15.2.10.5.20 String#hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
15.2.10.5.21 String#include? . . . . . . . . . . . . . . . . . . . . . . . . . . 186
15.2.10.5.22 String#index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
15.2.10.5.23 String#initialize . . . . . . . . . . . . . . . . . . . . . . . . . . 187
15.2.10.5.24 String#initialize copy . . . . . . . . . . . . . . . . . . . . . . . 188
15.2.10.5.25 String#intern . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
15.2.10.5.26 String#length . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
15.2.10.5.27 String#match . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
15.2.10.5.28 String#replace . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2.10.5.29 String#reverse . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2.10.5.30 String#reverse! . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2.10.5.31 String#rindex . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.2.10.5.32 String#scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
15.2.10.5.33 String#size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
15.2.10.5.34 String#slice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
15.2.10.5.35 String#split . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
15.2.10.5.36 String#sub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
15.2.10.5.37 String#sub! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
15.2.10.5.38 String#to f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
15.2.10.5.39 String#to i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
15.2.10.5.40 String#to s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
15.2.10.5.41 String#to sym . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
15.2.10.5.42 String#upcase . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
15.2.10.5.43 String#upcase! . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11 Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11.3 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11.3.1 Symbol#=== . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
15.2.11.3.2 Symbol#id2name . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2.11.3.3 Symbol#to s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2.11.3.4 Symbol#to sym . . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2.12 Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2.12.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
15.2.12.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.4 Singleton methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.4.1 Array.[] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.5 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.5.1 Array#+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
15.2.12.5.2 Array#* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
15.2.12.5.3 Array#<< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
15.2.12.5.4 Array#[] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
15.2.12.5.5 Array#[]= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
15.2.12.5.6 Array#clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
x'ISO/IEC 2012 — All rights reserved

15.2.12.5.7 Array#collect! . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
15.2.12.5.8 Array#concat . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
15.2.12.5.9 Array#delete at . . . . . . . . . . . . . . . . . . . . . . . . . . 202
15.2.12.5.10 Array#each . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
15.2.12.5.11 Array#each index . . . . . . . . . . . . . . . . . . . . . . . . . 202
15.2.12.5.12 Array#empty? . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
15.2.12.5.13 Array#first . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
15.2.12.5.14 Array#index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.2.12.5.15 Array#initialize . . . . . . . . . . . . . . . . . . . . . . . . . . 204
15.2.12.5.16 Array#initialize copy . . . . . . . . . . . . . . . . . . . . . . . 205
15.2.12.5.17 Array#join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
15.2.12.5.18 Array#last . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
15.2.12.5.19 Array#length . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
15.2.12.5.20 Array#map! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.2.12.5.21 Array#pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.2.12.5.22 Array#push . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.2.12.5.23 Array#replace . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.2.12.5.24 Array#reverse . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
15.2.12.5.25 Array#reverse! . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
15.2.12.5.26 Array#rindex . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
15.2.12.5.27 Array#shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
15.2.12.5.28 Array#size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.2.12.5.29 Array#slice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.2.12.5.30 Array#unshift . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.2.13 Hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.2.13.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
15.2.13.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.2.13.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.2.13.4 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.2.13.4.1 Hash#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
15.2.13.4.2 Hash#[] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.2.13.4.3 Hash#[]= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.2.13.4.4 Hash#clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.2.13.4.5 Hash#default . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.2.13.4.6 Hash#default= . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.2.13.4.7 Hash#default proc . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.13.4.8 Hash#delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.13.4.9 Hash#each . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.13.4.10 Hash#each key . . . . . . . . . . . . . . . . . . . . . . . . . . 214
15.2.13.4.11 Hash#each value . . . . . . . . . . . . . . . . . . . . . . . . . 214
15.2.13.4.12 Hash#empty? . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
15.2.13.4.13 Hash#has key? . . . . . . . . . . . . . . . . . . . . . . . . . . 215
15.2.13.4.14 Hash#has value? . . . . . . . . . . . . . . . . . . . . . . . . . 215
15.2.13.4.15 Hash#include? . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
15.2.13.4.16 Hash#initialize. . . . . . . . . . . . . . . . . . . . . . . . . . . 215
15.2.13.4.17 Hash#initialize copy . . . . . . . . . . . . . . . . . . . . . . . 216
15.2.13.4.18 Hash#key? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
15.2.13.4.19 Hash#keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
15.2.13.4.20 Hash#length . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
15.2.13.4.21 Hash#member? . . . . . . . . . . . . . . . . . . . . . . . . . . 217
15.2.13.4.22 Hash#merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
15.2.13.4.23 Hash#replace . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
'ISO/IEC 2012 — All rights reserved xi

15.2.13.4.24 Hash#shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
15.2.13.4.25 Hash#size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
15.2.13.4.26 Hash#store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.13.4.27 Hash#value? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.13.4.28 Hash#values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.14 Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.14.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.14.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
15.2.14.3 Included modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
15.2.14.4 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
15.2.14.4.1 Range#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
15.2.14.4.2 Range#=== . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
15.2.14.4.3 Range#begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
15.2.14.4.4 Range#each . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
15.2.14.4.5 Range#end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
15.2.14.4.6 Range#exclude end? . . . . . . . . . . . . . . . . . . . . . . . 222
15.2.14.4.7 Range#first . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
15.2.14.4.8 Range#include? . . . . . . . . . . . . . . . . . . . . . . . . . . 222
15.2.14.4.9 Range#initialize . . . . . . . . . . . . . . . . . . . . . . . . . . 222
15.2.14.4.10 Range#last . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
15.2.14.4.11 Range#member? . . . . . . . . . . . . . . . . . . . . . . . . . 223
15.2.15 Regexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
15.2.15.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
15.2.15.2 Direct superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
15.2.15.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
15.2.15.4 Patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
15.2.15.5 Matching process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
15.2.15.6 Singleton methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
15.2.15.6.1 Regexp.compile . . . . . . . . . . . . . . . . . . . . . . . . . . 229
15.2.15.6.2 Regexp.escape . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
15.2.15.6.3 Regexp.last match . . . . . . . . . . . . . . . . . . . . . . . . . 230
15.2.15.6.4 Regexp.quote . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
15.2.15.7 Instance methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
15.2.15.7.1 Regexp#== . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
15.2.15.7.2 Regexp#=== . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
15.2.15.7.3 Regexp#=˜ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
15.2.15.7.4 Regexp#casefold? . . . . . . . . . . . . . . . . . . . . . . . . . 232
15.2.15.7.5 Regexp#initialize . . . . . . . . . . . . . . . . . . . . . . . . . 233
15.2.15.7.6 Regexp#initialize copy . . . . . . . . . . . . . . . . . . . . . . 233
15.2.15.7.7 Regexp#match . . . . . . . . . . . . . .
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...