1 2 3 4<!DOCTYPE HTML> 5<html lang="en"> 6 <head> 7 <meta charset="UTF-8"> 8 <title>Introduction - Ruby Reference</title> 9 <meta name="viewport" content="width=device-width, initial-scale=1"> 10 11 <!-- CSS stolen from mdBook --> 12 <link rel="stylesheet" href="/rubyref/css/book.css"> 13 <!-- ...and our additions to it --> 14 <link rel="stylesheet" href="/rubyref/css/book-aux.css"> 15 <link rel="stylesheet" href="/rubyref/css/highlight.css"> 16 <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'> 17 18 <!-- Font Awesome --> 19 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> 20 21 <!-- Fetch JQuery from CDN but have a local fallback --> 22
22<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
22 23
23<script> 24 if (typeof jQuery == 'undefined') { 25 document.write(unescape("%3Cscript src='/rubyref/js/jquery.js'%3E%3C/script%3E")); 26 } 27 </script>
27 28 </head> 29 <body> 30 <!-- Set the theme before any content is loaded, prevents flash --> 31
31<script> 32 var theme = localStorage.getItem('theme'); 33 if (theme == null) { theme = 'light'; } 34 $('body').removeClass().addClass(theme); 35 </script>
35 36 37 <!-- Hide / unhide sidebar before it is displayed --> 38
38<script> 39 var html = document.querySelector('html'); 40 var sidebar = 'hidden'; 41 if (document.body.clientWidth >= 1080) { 42 try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } 43 sidebar = sidebar || 'visible'; 44 } 45 html.classList.remove('sidebar-visible'); 46 html.classList.add("sidebar-" + sidebar); 47 </script>
47 48 49 <nav id="sidebar" class="sidebar"> 50 <ul class="chapter"> 51 52 53 <li> 54 <a href="/rubyref/"class="active" > Introduction</a> 55 </li> 56 57 <ul class="section"> 58 59 <li> 60 <a href="/rubyref/intro/installation.html" > Installation</a> 61 </li> 62 63 64 <li> 65 <a href="/rubyref/intro/implementations.html" > Other Implementations of Ruby</a> 66 </li> 67 68 69 <li> 70 <a href="/rubyref/intro/irb.html" > Interactive Console</a> 71 </li> 72 73 74 <li> 75 <a href="/rubyref/intro/quickstart.html" > Ruby in Twenty Minutes</a> 76 </li> 77 78 79 </ul> 80 81 82 <li> 83 <a href="/rubyref/language.html" > Language Structure</a> 84 </li> 85 86 <ul class="section"> 87 88 <li> 89 <a href="/rubyref/language/keywords.html" > Keywords</a> 90 </li> 91 92 93 <li> 94 <a href="/rubyref/language/literals.html" > Literals</a> 95 </li> 96 97 98 <li> 99 <a href="/rubyref/language/comments.html" > Comments</a> 100 </li> 101 102 103 <li> 104 <a href="/rubyref/language/variables-constants.html" > Variables and Constants</a> 105 </li> 106 107 108 <li> 109 <a href="/rubyref/language/assignment.html" > Assignment</a> 110 </li> 111 112 113 <li> 114 <a href="/rubyref/language/control-expressions.html" > Control Expressions</a> 115 </li> 116 117 118 <li> 119 <a href="/rubyref/language/pattern-matching.html" > Pattern matching</a> 120 </li> 121 122 123 <li> 124 <a href="/rubyref/language/methods-def.html" > Defining methods</a> 125 </li> 126 127 128 <li> 129 <a href="/rubyref/language/methods-call.html" > Calling methods</a> 130 </li> 131 132 133 <li> 134 <a href="/rubyref/language/modules-classes.html" > Modules and Classes</a> 135 </li> 136 137 138 <li> 139 <a href="/rubyref/language/exceptions.html" > Exceptions</a> 140 </li> 141 142 143 <li> 144 <a href="/rubyref/language/refinements.html" > Refinements</a> 145 </li> 146 147 148 <li> 149 <a href="/rubyref/language/precedence.html" > Precedence</a> 150 </li> 151 152 153 <li> 154 <a href="/rubyref/language/misc.html" > Miscellaneous Syntax</a> 155 </li> 156 157 158 <li> 159 <a href="/rubyref/language/files.html" > File Structure</a> 160 </li> 161 162 163 <li> 164 <a href="/rubyref/language/globals.html" > Globals</a> 165 </li> 166 167 168 <li> 169 <a href="/rubyref/language/metaprogramming.html" > Metaprogramming and DSL</a> 170 </li> 171 172 173 </ul> 174 175 176 <li> 177 <a href="/rubyref/builtin.html" > Built-in Classes</a> 178 </li> 179 180 <ul class="section"> 181 182 <li> 183 <a href="/rubyref/builtin/core.html" > Language Core</a> 184 </li> 185 186 <ul class="subsection"> 187 188 <li> 189 <a href="/rubyref/builtin/core/kernel.html" > Kernel</a> 190 </li> 191 192 <li> 193 <a href="/rubyref/builtin/core/object.html" > Object</a> 194 </li> 195 196 <li> 197 <a href="/rubyref/builtin/core/module-class.html" > Module and Class</a> 198 </li> 199 200 <li> 201 <a href="/rubyref/builtin/core/method-proc.html" > Method and Proc</a> 202 </li> 203 204 <li> 205 <a href="/rubyref/builtin/core/binding.html" > Binding</a> 206 </li> 207 208 </ul> 209 210 211 <li> 212 <a href="/rubyref/builtin/types.html" > Value Types</a> 213 </li> 214 215 <ul class="subsection"> 216 217 <li> 218 <a href="/rubyref/builtin/types/atomic.html" > true, false, nil</a> 219 </li> 220 221 <li> 222 <a href="/rubyref/builtin/types/comparable.html" > Comparable</a> 223 </li> 224 225 <li> 226 <a href="/rubyref/builtin/types/numbers.html" > Numbers</a> 227 </li> 228 229 <li> 230 <a href="/rubyref/builtin/types/symbol-string.html" > Symbol and String</a> 231 </li> 232 233 <li> 234 <a href="/rubyref/builtin/types/regexp.html" > Regexp</a> 235 </li> 236 237 <li> 238 <a href="/rubyref/builtin/types/range.html" > Range</a> 239 </li> 240 241 <li> 242 <a href="/rubyref/builtin/types/struct.html" > Struct</a> 243 </li> 244 245 <li> 246 <a href="/rubyref/builtin/types/times-dates.html" > Times and Dates</a> 247 </li> 248 249 <li> 250 <a href="/rubyref/builtin/types/enumerable.html" > Enumerable</a> 251 </li> 252 253 <li> 254 <a href="/rubyref/builtin/types/array.html" > Array</a> 255 </li> 256 257 <li> 258 <a href="/rubyref/builtin/types/hash.html" > Hash</a> 259 </li> 260 261 <li> 262 <a href="/rubyref/builtin/types/set.html" > Set</a> 263 </li> 264 265 <li> 266 <a href="/rubyref/builtin/types/matrix.html" >
266 Matrix</a> 267 </li> 268 269 </ul> 270 271 272 <li> 273 <a href="/rubyref/builtin/exception.html" > Exception</a> 274 </li> 275 276 <ul class="subsection"> 277 278 <li> 279 <a href="/rubyref/builtin/exception/exception-classes.html" > Exception Classes</a> 280 </li> 281 282 </ul> 283 284 285 <li> 286 <a href="/rubyref/builtin/warning.html" > Warning</a> 287 </li> 288 289 290 <li> 291 <a href="/rubyref/builtin/system-cli.html" > System Programming and CLI</a> 292 </li> 293 294 <ul class="subsection"> 295 296 <li> 297 <a href="/rubyref/builtin/system-cli/processes-signals.html" > Processes and Signals</a> 298 </li> 299 300 <li> 301 <a href="/rubyref/builtin/system-cli/io.html" > IO Basics</a> 302 </li> 303 304 <li> 305 <a href="/rubyref/builtin/system-cli/filesystem.html" > Filesystem</a> 306 </li> 307 308 <li> 309 <a href="/rubyref/builtin/system-cli/args.html" > Arguments and Environment</a> 310 </li> 311 312 </ul> 313 314 315 <li> 316 <a href="/rubyref/builtin/concurrency-parallelism.html" > Concurrency and Parallelism</a> 317 </li> 318 319 320 <li> 321 <a href="/rubyref/builtin/internals.html" > Interpreter Internals</a> 322 </li> 323 324 <ul class="subsection"> 325 326 <li> 327 <a href="/rubyref/builtin/internals/rubyvm.html" > RubyVM</a> 328 </li> 329 330 </ul> 331 332 333 <li> 334 <a href="/rubyref/builtin/marshal.html" > Marshal</a> 335 </li> 336 337 338 </ul> 339 340 341 <li> 342 <a href="/rubyref/stdlib.html" > Standard Library</a> 343 </li> 344 345 <ul class="section"> 346 347 <li> 348 <a href="/rubyref/stdlib/patterns.html" > Design Patterns</a> 349 </li> 350 351 <ul class="subsection"> 352 353 <li> 354 <a href="/rubyref/stdlib/patterns/forwardable.html" > forwardable</a> 355 </li> 356 357 <li> 358 <a href="/rubyref/stdlib/patterns/delegate.html" > delegate</a> 359 </li> 360 361 <li> 362 <a href="/rubyref/stdlib/patterns/observer.html" > observer</a> 363 </li> 364 365 <li> 366 <a href="/rubyref/stdlib/patterns/singleton.html" > singleton</a> 367 </li> 368 369 </ul> 370 371 372 <li> 373 <a href="/rubyref/stdlib/formats.html" > Formats</a> 374 </li> 375 376 <ul class="subsection"> 377 378 <li> 379 <a href="/rubyref/stdlib/formats/csv.html" > csv</a> 380 </li> 381 382 <li> 383 <a href="/rubyref/stdlib/formats/json.html" > json</a> 384 </li> 385 386 <li> 387 <a href="/rubyref/stdlib/formats/yaml.html" > yaml</a> 388 </li> 389 390 <li> 391 <a href="/rubyref/stdlib/formats/rexml.html" > rexml: XML parser and generator</a> 392 </li> 393 394 <li> 395 <a href="/rubyref/stdlib/formats/rss.html" > rss</a> 396 </li> 397 398 <li> 399 <a href="/rubyref/stdlib/formats/zlib.html" >
399 zlib</a> 400 </li> 401 402 </ul> 403 404 405 <li> 406 <a href="/rubyref/stdlib/development.html" > Development and Debugging</a> 407 </li> 408 409 <ul class="subsection"> 410 411 <li> 412 <a href="/rubyref/stdlib/development/benchmark.html" > benchmark</a> 413 </li> 414 415 <li> 416 <a href="/rubyref/stdlib/development/coverage.html" > coverage</a> 417 </li> 418 419 <li> 420 <a href="/rubyref/stdlib/development/debug.html" > debug</a> 421 </li> 422 423 <li> 424 <a href="/rubyref/stdlib/development/fiddle.html" > fiddle: FFI wrapper</a> 425 </li> 426 427 <li> 428 <a href="/rubyref/stdlib/development/logger.html" > logger</a> 429 </li> 430 431 <li> 432 <a href="/rubyref/stdlib/development/pp.html" > pp: Debug Print</a> 433 </li> 434 435 <li> 436 <a href="/rubyref/stdlib/development/ripper.html" > ripper: Parsing Ruby</a> 437 </li> 438 439 <li> 440 <a href="/rubyref/stdlib/development/tracer.html" > tracer</a> 441 </li> 442 443 </ul> 444 445 446 <li> 447 <a href="/rubyref/stdlib/string-utilities.html" > String Utilities</a> 448 </li> 449 450 <ul class="subsection"> 451 452 <li> 453 <a href="/rubyref/stdlib/string-utilities/erb.html" > erb: Ruby Templating</a> 454 </li> 455 456 <li> 457 <a href="/rubyref/stdlib/string-utilities/racc.html" > racc: Parser Generator</a> 458 </li> 459 460 <li> 461 <a href="/rubyref/stdlib/string-utilities/shellwords.html" > shellwords: Shell-aware string manipulation</a> 462 </li> 463 464 <li> 465 <a href="/rubyref/stdlib/string-utilities/strscan.html" > strscan: Sequental String Scanner</a> 466 </li> 467 468 <li> 469 <a href="/rubyref/stdlib/string-utilities/did_you_mean.html" > did_you_mean: Typo suggestions</a> 470 </li> 471 472 </ul> 473 474 475 <li> 476 <a href="/rubyref/stdlib/networking-web.html" > Networking and Web</a> 477 </li> 478 479 <ul class="subsection"> 480 481 <li> 482 <a href="/rubyref/stdlib/networking-web/cgi.html" > cgi</a> 483 </li> 484 485 <li> 486 <a href="/rubyref/stdlib/networking-web/ipaddr.html" > ipaddr</a> 487 </li> 488 489 <li> 490 <a href="/rubyref/stdlib/networking-web/net/ftp.html" > net/ftp</a> 491 </li> 492 493 <li> 494 <a href="/rubyref/stdlib/networking-web/net/http.html" > net/http</a> 495 </li> 496 497 <li> 498 <a href="/rubyref/stdlib/networking-web/net/imap.html" > net/imap</a> 499 </li> 500 501 <li> 502 <a href="/rubyref/stdlib/networking-web/net/pop.html" > net/pop</a> 503 </li> 504 505 <li> 506 <a href="/rubyref/stdlib/networking-web/net/smtp.html" > net/smtp</a> 507 </li> 508 509 <li> 510 <a href="/rubyref/stdlib/networking-web/openuri.html" > openuri: Open Files and URLs</a> 511 </li> 512 513 <li> 514 <a href="/rubyref/stdlib/networking-web/resolv.html" >
514 resolv: DNS Resolver</a> 515 </li> 516 517 <li> 518 <a href="/rubyref/stdlib/networking-web/socket.html" > socket</a> 519 </li> 520 521 <li> 522 <a href="/rubyref/stdlib/networking-web/webrick.html" > webrick: Simple Web Server</a> 523 </li> 524 525 <li> 526 <a href="/rubyref/stdlib/networking-web/uri.html" > uri</a> 527 </li> 528 529 </ul> 530 531 532 <li> 533 <a href="/rubyref/stdlib/cli.html" > System Programming and CLI</a> 534 </li> 535 536 <ul class="subsection"> 537 538 <li> 539 <a href="/rubyref/stdlib/cli/etc.html" > etc: Access to Unix /etc</a> 540 </li> 541 542 <li> 543 <a href="/rubyref/stdlib/cli/fcntl.html" > fcntl: POSIX file access constants</a> 544 </li> 545 546 <li> 547 <a href="/rubyref/stdlib/cli/open3.html" > open3: Flexible child processes</a> 548 </li> 549 550 <li> 551 <a href="/rubyref/stdlib/cli/optparse.html" > optparse: CLI arguments parser</a> 552 </li> 553 554 <li> 555 <a href="/rubyref/stdlib/cli/pty.html" > pty: Pseudo terminal</a> 556 </li> 557 558 <li> 559 <a href="/rubyref/stdlib/cli/readline.html" > readline</a> 560 </li> 561 562 <li> 563 <a href="/rubyref/stdlib/cli/syslog.html" > syslog</a> 564 </li> 565 566 <li> 567 <a href="/rubyref/stdlib/cli/win32ole.html" > win32ole</a> 568 </li> 569 570 </ul> 571 572 573 <li> 574 <a href="/rubyref/stdlib/cryptography-encoding.html" > Cryptography and Encoding</a> 575 </li> 576 577 <ul class="subsection"> 578 579 <li> 580 <a href="/rubyref/stdlib/cryptography-encoding/base64.html" > base64</a> 581 </li> 582 583 <li> 584 <a href="/rubyref/stdlib/cryptography-encoding/digest.html" > digest</a> 585 </li> 586 587 <li> 588 <a href="/rubyref/stdlib/cryptography-encoding/openssl.html" > openssl</a> 589 </li> 590 591 </ul> 592 593 594 <li> 595 <a href="/rubyref/stdlib/misc.html" > Miscellaneous Libraries</a> 596 </li> 597 598 <ul class="subsection"> 599 600 <li> 601 <a href="/rubyref/stdlib/misc/concurrency-utils.html" > Concurrency Utils</a> 602 </li> 603 604 <li> 605 <a href="/rubyref/stdlib/misc/drb.html" > drb: Distributed Ruby</a> 606 </li> 607 608 <li> 609 <a href="/rubyref/stdlib/misc/dbm.html" > dbm, gdbm, sdbm</a> 610 </li> 611 612 <li> 613 <a href="/rubyref/stdlib/misc/timeout.html" > timeout</a> 614 </li> 615 616 <li> 617 <a href="/rubyref/stdlib/misc/other.html" > Other Libraries</a> 618 </li> 619 620 </ul> 621 622 623 <li> 624 <a href="/rubyref/stdlib/bundled.html" > Bundled Gems</a> 625 </li> 626 627 628 </ul> 629 630 631 <li> 632 <a href="/rubyref/developing.html" > Developing in Ruby</a> 633 </li> 634 635 <ul class="section"> 636 637 <li> 638 <a href="/rubyref/developing/libraries.html" > Libraries</a> 639 </li> 640 641 <ul class="subsection"> 642 643 <li> 644 <a href="/rubyref/developing/libraries/bundler.html" > Bundler dependency manager</a> 645 </li> 646 647 </ul> 648 649 650 <li> 651 <a href="/rubyref/developing/irb.html" > Mastering IRB</a> 652 </li> 653 654 655 <li> 656 <a href="/rubyref/developing/documenting.html" > Documenting Ruby Code</a> 657 </li> 658 659 660 <li> 661 <a href="/rubyref/developing/testing.html" > Testing Ruby Code</a> 662 </li> 663 664 665 <li>
666 <a href="/rubyref/developing/code-style.html" > Code Style</a> 667 </li> 668 669 670 </ul> 671 672 673 <li> 674 <a href="/rubyref/advanced.html" > Advanced Topics</a> 675 </li> 676 677 <ul class="section"> 678 679 <li> 680 <a href="/rubyref/advanced/extensions.html" > Developing C Extensions</a> 681 </li> 682 683 684 <li> 685 <a href="/rubyref/advanced/security.html" > Security</a> 686 </li> 687 688 689 <li> 690 <a href="/rubyref/advanced/dtrace.html" > DTrace</a> 691 </li> 692 693 694 <li> 695 <a href="/rubyref/advanced/signals.html" > Implementing Signal.trap callbacks</a> 696 </li> 697 698 699 <li> 700 <a href="/rubyref/advanced/contributing.html" > Contributing To Ruby</a> 701 </li> 702 703 704 </ul> 705 706 707 <li> 708 <a href="/rubyref/appendix-a.html" > Appendix A: Kernel methods list</a> 709 </li> 710 711 712 <li> 713 <a href="/rubyref/appendix-b.html" > Appendix B: Useful Links</a> 714 </li> 715 716 717 718 </ul> 719 </nav> 720 721 <div id="page-wrapper" class="page-wrapper"> 722 723 <div class="page"> 724 <div id="menu-bar" class="menu-bar bordered"> 725 <div id="menu-bar-sticky-container"> 726 <div class="left-buttons"> 727 <i id="sidebar-toggle" class="fa fa-bars"></i> 728 <!-- <i id="theme-toggle" class="fa fa-paint-brush"></i> --> 729 </div> 730 731 <h1 class="menu-title">Ruby <small>2.7</small> Reference <a style="font-weight: bold; color: #0057b7;" href="https://linktr.ee/RazomForUkraine">SAVE <span style="color: #ffd700;">UKRAINE</span></a></h1> 732 733 <div class="right-buttons"> 734 <!-- <i id="print-button" class="fa fa-print" title="Print this book"></i> --> 735 </div> 736 </div> 737 </div> 738 739 <div id="content" class="content"> 740 <main><h2 id="the-ruby-reference">The Ruby Reference<a href="#the-ruby-reference"></a></h2> 741 742<p>This book is a reference for the <a href="https://www.ruby-lang.org/" class="remote" target="_blank">Ruby programming language</a>. It describes the language structure, its core classes and standard library, and provides some additional useful information and links for Ruby development.</p> 743 744<p>The Reference is intended to be always up-to-date with the current Ruby version.</p> 745 746<p>Most of the reference content is taken directly from <a href="https://ruby-doc.org" class="ruby-doc remote" target="_blank">Ruby documentation</a> and reorganized for easier reading. The core docs were augmented with some quotes from the <a href="https://ruby-lang.org" class="remote" target="_blank">Ruby website</a>, and some missing content that is written specifically for the book. The source of the book (rendering scripts, config, and unique content) can be found at <a href="https://github.com/rubyreferences/rubyref/tree/master/_src" class="remote" target="_blank">GitHub</a>.</p> 747 748<p>Happy Hacking!</p> 749 750</main> 751 752 <nav class="nav-wrapper"> 753 <!-- Mobile navigation buttons --> 754 755 756 757 <a rel="next" href="/rubyref/intro/installation.html" class="mobile-nav-chapters next" title="Next chapter"> 758 <i class="fa fa-angle-right"></i> 759 </a> 760 761 762 <div style="clear: both"></div> 763 </nav> 764 </div> 765 </div> 766 767 768 769 <!-- 770 <a href="cli/cli-tool.html" class="nav-chapters next" title="You can navigate through the chapters using the arrow keys"> 771 <i class="fa fa-angle-right"></i> 772 </a> 773 --> 774 775 </div> 776 777 778
778<script src="/rubyref/js/book.js"></script>
778 779 </body> 780</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.