File: //usr/share/ri/3.0.0/system/Kernel/Rational-i.ri
U:RDoc::AnyMethod[iI"
Rational:ETI"Kernel#Rational;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"*Returns +x/y+ or +arg+ as a Rational.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I" Rational(2, 3) #=> (2/3)
;TI" Rational(5) #=> (5/1)
;TI" Rational(0.5) #=> (1/2)
;TI"?Rational(0.3) #=> (5404319552844595/18014398509481984)
;TI"
;TI" Rational("2/3") #=> (2/3)
;TI"!Rational("0.3") #=> (3/10)
;TI"
;TI"-Rational("10 cents") #=> ArgumentError
;TI")Rational(nil) #=> TypeError
;TI")Rational(1, nil) #=> TypeError
;TI"
;TI"5Rational("10 cents", exception: false) #=> nil
;T:@format0o;
; [I"Syntax of the string form:;T@o;; [I"<string form = extra spaces , rational , extra spaces ;
;TI"/rational = [ sign ] , unsigned rational ;
;TI"Eunsigned rational = numerator | numerator , "/" , denominator ;
;TI"Snumerator = integer part | fractional part | integer part , fractional part ;
;TI"denominator = digits ;
;TI"integer part = digits ;
;TI"Nfractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ;
;TI"sign = "-" | "+" ;
;TI"0digits = digit , { digit | "_" , digit } ;
;TI"Idigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
;TI"extra spaces = ? \s* ? ;
;T;
0o;
; [I"See also String#to_r.;T:
@fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"oRational(x, y, exception: true) -> rational or nil
Rational(arg, exception: true) -> rational or nil
;T0[ I"(p1, p2 = v2, p3 = {});T@1FI"Kernel;TcRDoc::NormalModule00