PATH:
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Kernel
U:RDoc::AnyMethod[iI"Integer:ETI"Kernel#Integer;TF:publico:RDoc::Markup::Document:@parts[1o:RDoc::Markup::Paragraph; [I"0Returns an integer converted from +object+.;To:RDoc::Markup::BlankLine o; ; [I"-Tries to convert +object+ to an integer ;TI"-using +to_int+ first and +to_i+ second; ;TI"see below for exceptions.;T@o; ; [I"FWith a non-zero +base+, +object+ must be a string or convertible ;TI"to a string.;T@S:RDoc::Markup::Heading: leveli : textI"\Numeric objects;T@o; ; [I"?With an integer argument +object+ given, returns +object+:;T@o:RDoc::Markup::Verbatim; [I"&Integer(1) # => 1 ;TI"'Integer(-1) # => -1 ;T:@format0o; ; [I"4With a floating-point argument +object+ given, ;TI".returns +object+ truncated to an integer:;T@o;; [I"=Integer(1.9) # => 1 # Rounds toward zero. ;TI"=Integer(-1.9) # => -1 # Rounds toward zero. ;T;0S;; i ;I"\String objects;T@o; ; [I"<With a string argument +object+ and zero +base+ given, ;TI"9returns +object+ converted to an integer in base 10:;T@o;; [I" Integer('100') # => 100 ;TI"!Integer('-100') # => -100 ;T;0o; ; [I"FWith +base+ zero, string +object+ may contain leading characters ;TI"2to specify the actual base (radix indicator):;T@o;; [I"?Integer('0100') # => 64 # Leading '0' specifies base 8. ;TI"@Integer('0b100') # => 4 # Leading '0b' specifies base 2. ;TI"AInteger('0x100') # => 256 # Leading '0x' specifies base 16. ;T;0o; ; [I"EWith a positive +base+ (in range 2..36) given, returns +object+ ;TI"/converted to an integer in the given base:;T@o;; [I" Integer('100', 2) # => 4 ;TI"!Integer('100', 8) # => 64 ;TI"#Integer('-100', 16) # => -256 ;T;0o; ; [I"GWith a negative +base+ (in range -36..-2) given, returns +object+ ;TI"6converted to the radix indicator if it exists or ;TI"+base+:;T@o;; [I"%Integer('0x100', -2) # => 256 ;TI"#Integer('100', -2) # => 4 ;TI"#Integer('0b100', -8) # => 4 ;TI"$Integer('100', -8) # => 64 ;TI"$Integer('0o100', -10) # => 64 ;TI"%Integer('100', -10) # => 100 ;T;0o; ; [I"-+base+ -1 is equivalent to the -10 case.;T@o; ; [I"NWhen converting strings, surrounding whitespace and embedded underscores ;TI"are allowed and ignored:;T@o;; [I"$Integer(' 100 ') # => 100 ;TI"%Integer('-1_0_0', 16) # => -256 ;T;0S;; i ;I"Other classes;T@o; ; [I"5Examples with +object+ of various other classes:;T@o;; [I"<Integer(Rational(9, 10)) # => 0 # Rounds toward zero. ;TI"EInteger(Complex(2, 0)) # => 2 # Imaginary part must be zero. ;TI".Integer(Time.now) # => 1650974042 ;T;0S;; i ;I" Keywords;T@o; ; [I"RWith the optional keyword argument +exception+ given as +true+ (the default):;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"IRaises TypeError if +object+ does not respond to +to_int+ or +to_i+.;To;;0; [o; ; [I"+Raises TypeError if +object+ is +nil+.;To;;0; [o; ; [I";Raises ArgumentError if +object+ is an invalid string.;T@o; ; [I"OWith +exception+ given as +false+, an exception of any kind is suppressed ;TI"and +nil+ is returned.;T: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"BInteger(object, base = 0, exception: true) -> integer or nil ;T0[ I"%(arg, base = 0, exception: true);T@|FI"Kernel;TcRDoc::NormalModule00
[+]
..
[-] loop-i.ri
[edit]
[-] Complex-i.ri
[edit]
[-] Pathname-i.ri
[edit]
[-] block_given%3f-i.ri
[edit]
[-] format-i.ri
[edit]
[-] readlines-i.ri
[edit]
[-] chop-i.ri
[edit]
[-] tap-i.ri
[edit]
[-] Hash-i.ri
[edit]
[-] catch-i.ri
[edit]
[-] warn-i.ri
[edit]
[-] exec-i.ri
[edit]
[-] iterator%3f-i.ri
[edit]
[-] Float-i.ri
[edit]
[-] spawn-i.ri
[edit]
[-] require_relative-i.ri
[edit]
[-] yield_self-i.ri
[edit]
[-] __method__-i.ri
[edit]
[-] %60-i.ri
[edit]
[-] caller_locations-i.ri
[edit]
[-] syscall-i.ri
[edit]
[-] printf-i.ri
[edit]
[-] then-i.ri
[edit]
[-] clone-i.ri
[edit]
[-] gem-i.ri
[edit]
[-] global_variables-i.ri
[edit]
[-] set_trace_func-i.ri
[edit]
[-] eval-i.ri
[edit]
[-] exit%21-i.ri
[edit]
[-] String-i.ri
[edit]
[-] autoload-i.ri
[edit]
[-] p-i.ri
[edit]
[-] pp-c.ri
[edit]
[-] pretty_inspect-i.ri
[edit]
[-] class-i.ri
[edit]
[-] __callee__-i.ri
[edit]
[-] srand-i.ri
[edit]
[-] putc-i.ri
[edit]
[-] jj-i.ri
[edit]
[-] system-i.ri
[edit]
[-] trap-i.ri
[edit]
[-] lambda-i.ri
[edit]
[-] caller-i.ri
[edit]
[-] abort-i.ri
[edit]
[-] sprintf-i.ri
[edit]
[-] callcc-i.ri
[edit]
[-] readline-i.ri
[edit]
[-] sleep-i.ri
[edit]
[-] Array-i.ri
[edit]
[-] autoload%3f-i.ri
[edit]
[-] gsub-i.ri
[edit]
[-] proc-i.ri
[edit]
[-] puts-i.ri
[edit]
[-] trace_var-i.ri
[edit]
[-] pp-i.ri
[edit]
[-] rand-i.ri
[edit]
[-] JSON-i.ri
[edit]
[-] chomp-i.ri
[edit]
[-] __dir__-i.ri
[edit]
[-] y-i.ri
[edit]
[-] untrace_var-i.ri
[edit]
[-] gets-i.ri
[edit]
[-] Rational-i.ri
[edit]
[-] at_exit-i.ri
[edit]
[-] fork-i.ri
[edit]
[-] local_variables-i.ri
[edit]
[-] select-i.ri
[edit]
[-] fail-i.ri
[edit]
[-] Integer-i.ri
[edit]
[-] raise-i.ri
[edit]
[-] test-i.ri
[edit]
[-] URI-c.ri
[edit]
[-] exit-i.ri
[edit]
[-] throw-i.ri
[edit]
[-] cdesc-Kernel.ri
[edit]
[-] binding-i.ri
[edit]
[-] j-i.ri
[edit]
[-] frozen%3f-i.ri
[edit]
[-] URI-i.ri
[edit]
[-] load-i.ri
[edit]
[-] open-i.ri
[edit]
[-] sub-i.ri
[edit]
[-] require-i.ri
[edit]
[-] print-i.ri
[edit]