RUBY(1) 1 (ruby programmer's reference guide) RUBY(1) (NAME) ruby - (SYNOPSIS) ruby [--copyright] [--version] [-SUacdlnpswvy] [-0[octal]] [-C directory] [-E external[:internal]] [-F[pattern]] [-I directory] [-K[c]] [-T[level]] [-W[level]] [-e command] [-i[extension]] [-r library] [-x[directory]] [--{enable|disable}-FEATURE] [--dump=target] [--verbose] [--crash-report=template] [--] [program_file] [argument ...] (DESCRIPTION) Ruby . ( Perl) . . Perl LISP Ruby . (FEATURES) Ruby : Ruby Ruby . ( ) Ruby . . . Ruby . () - . Ruby Eiffel . Ruby . (garbage collector) . Ruby . . Ruby . (Singleton methods) Ruby . singleton method . (prototype-based) . (Mix-in) Ruby . Ruby . `Mix-in' . (Iterators) Ruby (iterator) . (Closures) Ruby . Ruby Perl . (M17N) Ruby . Unicode . (Bignums) !400 ( ) . (DSLs) Class . 1+1 (expression) . . Ruby . Java(tm). Ruby UNIX . UNIX (on-the-fly) Ruby . " " " " Ruby ("gems") `RubyGems' ( gem(1)) . RubyGems.org (https://rubygems.org) gem GitHub (https://github) . (OPTIONS) Ruby () . perl(1) . --copyright . --version Ruby . -0[octal] ( "zero.") ($/) () . null . . -00 Ruby . -0777 Ruby . -C directory -X directory Ruby . -E external[:internal] --encoding external[:internal] () . (:) . (Encoding.default_internal) nil . --external-encoding=encoding --internal-encoding=encoding . -F pattern ($;) . -I directory Ruby . load- path ($:) . -K kcode KANJI () . (__ENCODING__) (Encoding.default_external) . kcode : e EUC-JP s Windows-31J (CP932) u UTF-8 n ASCII-8BIT (BINARY) -S Ruby PATH . #! : #! /usr/local/bin/ruby # This line makes the next one a comment in Ruby \ exec /usr/local/bin/ruby -S $0 $* $0 -S Ruby ( ). $* ${1+"$@"} csh(1) . -T[level=1] (taint checks) (: 1). -U (Encoding.default_internal) UTF-8 . -W[level=2] (verbose) . : 0 <<>> (silence) . $VERBOSE nil . 1 <<>> (medium) . $VERBOSE false . 2 () <<>> (verbose) . $VERBOSE true . -W2 -w . -a -n -p (auto-split) . Ruby $F = $_.split . --backtrace-limit=num (backtrace) num (: 1- ). -c Ruby . Ruby "Syntax OK" . -d --debug . $DEBUG true . -e command Ruby . -h --help . -i extension (in-place- edit) . . : % echo matz > /tmp/junk % cat /tmp/junk matz % ruby -p -i.bak -e '$_.upcase!' /tmp/junk % cat /tmp/junk MATZ % cat /tmp/junk.bak matz -l ( "ell.") $\ $/ chomp! . -n Ruby sed -n awk . while gets ... end -p -n $_ . : % echo matz | ruby -p -e '$_.tr! "a-z", "A-Z"' MATZ -r library Ruby require . -n -p . -s ( --) . ARGV . : #! /usr/local/bin/ruby -s # prints "true" if invoked with `-xyz' switch. print "true\n" if $xyz -v . Ruby $VERBOSE true . true . Ruby . -w . $VERBOSE true . -x[directory] Ruby . "#!" "ruby" . . EOF ^D (control-D) ^Z (control-Z) __END__ . Ruby . -y --yydebug . . Ruby . Ruby . --disable-FEATURE --enable-FEATURE FEATURE ( ) . --disable-gems --enable-gems RubyGems ( ) . Ruby gem . Gem RubyGems true false . --disable-rubyopt --enable-rubyopt RUBYOPT ( ). Ruby . --disable-all --enable-all ( ) . --dump=target . . target : version ( --version). usage ( -h). help ( --help). syntax ( -c --yydebug). : yydebug ( --yydebug). parsetree (AST) Ruby. insns . -optimize . +error-tolerant yydebug parsetree. +comment AST Ruby. --verbose . $VERBOSE true . ( -e) Ruby . --crash-report=template . RUBY_CRASH_REPORT . (ENVIRONMENT) RUBYLIB (:) Ruby ($:) . . : RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext" RUBYOPT Ruby. : RUBYOPT="-w -Ke" RUBYOPT -d, -E, -I, -K, -r, -T, -U, -v, -w, -W, --debug, --disable-FEATURE --enable-FEATURE . RUBYPATH (:) -S - Ruby Ruby . PATH . RUBYSHELL . mswin32 mingw32 OS/2 . Ruby COMSPEC . RUBY_FREE_AT_EXIT Ruby . Ruby 3.3 : . RUBY_IO_BUFFER_DEFAULT_SIZE IO::Buffer. RUBY_MAX_CPU (native threads) M:N Threads. Ruby 3.3 : 8. RUBY_MN_THREADS 1 M:N Ractor . Ruby 3.3 : . RUBY_PAGER (pager) --help . Ruby 3.0 : PAGER. RUBY_THREAD_TIMESLICE (thread quantum) . Ruby 3.4 : 100ms. PATH Ruby Kernel#system PATH . Ruby RubyGems RubyGems . gem(1) : % gem help (GC ENVIRONMENT) (GC) Ruby (slots) malloc C (malloc(3) calloc(3) realloc(3)) . <> Ruby <> << >> (process heap) . : 1 . 2 malloc. Ruby 2.1 (generational GC) (young) (old) GC : 3 . 4 malloc . : RUBY_GC_HEAP_n_INIT_SLOTS . GC.stat_heap . n 0 4 . Ruby 3.3. RUBY_GC_HEAP_FREE_SLOTS GC . . Ruby 2.1 : 4096. RUBY_GC_HEAP_GROWTH_FACTOR . Ruby 2.1 : 1.8 : 1.0 ( ). RUBY_GC_HEAP_GROWTH_MAX_SLOTS RUBY_GC_HEAP_GROWTH_FACTOR . Ruby 2.1 : 0 ( ). RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR GC R * N R N GC . Ruby 2.1.1 : 2.0. RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO remembered_wb_unprotected_objects_limit old_objects . Ruby 3.3 : 0.1 : 0.0. RUBY_GC_MALLOC_LIMIT malloc. . : 16MB. RUBY_GC_MALLOC_LIMIT_MAX malloc GC. malloc RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR . Ruby 2.1 : 32MB. RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR malloc GC malloc RUBY_GC_MALLOC_LIMIT_MAX . Ruby 2.1 : 1.4 : 1.0 ( ). RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO (total_slots * ( )) . Ruby 2.4 : 0.2 : 0.0 : 1.0. RUBY_GC_HEAP_FREE_SLOTS_MAX_RATIO (total_slots * ( )) . Ruby 2.4 : 0.4 : RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO : 1.0. RUBY_GC_HEAP_FREE_SLOTS_GOAL_RATIO : free_slots = total_slots * goal_ratio (total_slots * goal_ratio) . 0.0 RUBY_GC_HEAP_GROWTH_FACTOR . Ruby 2.4 : 0.65 : RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO : RUBY_GC_HEAP_FREE_SLOTS_MAX_RATIO. RUBY_GC_OLDMALLOC_LIMIT malloc GC . Ruby 2.1 : 16MB. RUBY_GC_OLDMALLOC_LIMIT_MAX malloc GC . malloc RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR . Ruby 2.1 : 128MB. RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR malloc GC malloc RUBY_GC_OLDMALLOC_LIMIT_MAX . Ruby 2.1 : 1.2 : 1.0 ( ). RUBY_SHARED_FIBER_POOL_FREE_STACKS 1 (pooled fibers) . 0 . Ruby 2.7 : 1 ( ). (STACK SIZE ENVIRONMENT) Ruby . (VM stack) Ruby . (Machine stack) C C . SystemStackError (SIGSEGV) . 2.0.0 Ruby . . RUBY_THREAD_VM_STACK_SIZE (VM) . : 524288 ( ) 1048575 ( ). RUBY_THREAD_MACHINE_STACK_SIZE . : 524288 1048575. RUBY_FIBER_VM_STACK_SIZE . : 65536 131072. RUBY_FIBER_MACHINE_STACK_SIZE . : 262144 524288. (CRASH REPORT ENVIRONMENT) RUBY_CRASH_REPORT . : (none). (Naming crash report files) % : %% %. %e (basename) . %E (/) (!). %f $0. %F $0 (/) (!). %p (PID) . %t (Epoch) 1970-01-01 00:00:00 +0000 (UTC). %NNN (). % % . . '/' . (Piping crash reports to a program) (|) ( ) . . (MISC ENVIRONMENT) RUBY_TCP_NO_FAST_FALLBACK 1 (fast fallback) TCPSocket.new Socket.tcp . 0 . Ruby 3.4 : . (SEE ALSO) https://www.ruby-lang.org . https://www.ruby-toolbox.com Ruby. (BUGS) o security@ruby-lang.org . . o Ruby (https://bugs.ruby-lang.org) . . (AUTHORS) Ruby Yukihiro Matsumoto . Ruby . UNIX April 14, 2018 UNIX