%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/cpanel/ea-ruby24/root/usr/share/ri/system/Range/
Upload File :
Create Path :
Current File : //opt/cpanel/ea-ruby24/root/usr/share/ri/system/Range/cdesc-Range.ri

U:RDoc::NormalClass[iI"
Range:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[:
@fileI"#ext/json/lib/json/add/range.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[
I"JA <code>Range</code> represents an interval---a set of values with a ;TI"?beginning and an end. Ranges may be constructed using the ;TI"-<em>s</em><code>..</code><em>e</em> and ;TI"<<em>s</em><code>...</code><em>e</em> literals, or with ;TI":Range::new. Ranges constructed using <code>..</code> ;TI"Hrun from the beginning to the end inclusively. Those created using ;TI"G<code>...</code> exclude the end value. When used as an iterator, ;TI".ranges return each value in the sequence.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim;[	I"(-1..-5).to_a      #=> []
;TI"1(-5..-1).to_a      #=> [-5, -4, -3, -2, -1]
;TI"6('a'..'e').to_a    #=> ["a", "b", "c", "d", "e"]
;TI"1('a'...'e').to_a   #=> ["a", "b", "c", "d"]
;T:@format0S:RDoc::Markup::Heading:
leveli:	textI"Custom Objects in Ranges;T@o;;[I"FRanges can be constructed using any objects that can be compared ;TI"*using the <code><=></code> operator. ;TI"MMethods that treat the range as a sequence (#each and methods inherited ;TI"=from Enumerable) expect the begin object to implement a ;TI"E<code>succ</code> method to return the next object in sequence. ;TI"7The #step and #include? methods require the begin ;TI"<object to implement <code>succ</code> or to be numeric.;T@o;;[	I"BIn the <code>Xs</code> class below both <code><=></code> and ;TI"F<code>succ</code> are implemented so <code>Xs</code> can be used ;TI"Fto construct ranges. Note that the Comparable module is included ;TI"Kso the <code>==</code> method is defined in terms of <code><=></code>.;T@o;
;[I":class Xs                # represent a string of 'x's
;TI"  include Comparable
;TI"  attr :length
;TI"  def initialize(n)
;TI"    @length = n
;TI"  end
;TI"  def succ
;TI"    Xs.new(@length + 1)
;TI"  end
;TI"  def <=>(other)
;TI""    @length <=> other.length
;TI"  end
;TI"  def to_s
;TI"+    sprintf "%2d #{inspect}", @length
;TI"  end
;TI"  def inspect
;TI"    'x' * @length
;TI"  end
;TI"	end
;T;0o;;[I">An example of using <code>Xs</code> to construct a range:;T@o;
;[I"0r = Xs.new(3)..Xs.new(6)   #=> xxx..xxxxxx
;TI"?r.to_a                     #=> [xxx, xxxx, xxxxx, xxxxxx]
;TI"(r.member?(Xs.new(5))       #=> true;T;0;	I"range.c;T;
0;	0;
0[[[[I"Enumerable;To;;[;	@O;
0I"range.c;T[[I"
class;T[[:public[[I"json_create;FI"#ext/json/lib/json/add/range.rb;T[I"new;T@W[:protected[[:private[[I"
instance;T[[;[[I"==;T@W[I"===;T@W[I"as_json;F@`[I"
begin;T@W[I"bsearch;T@W[I"cover?;T@W[I"	each;T@W[I"end;T@W[I"	eql?;T@W[I"exclude_end?;T@W[I"
first;T@W[I"	hash;T@W[I"
include?;T@W[I"inspect;T@W[I"	last;T@W[I"max;T@W[I"member?;T@W[I"min;T@W[I"	size;T@W[I"	step;T@W[I"to_json;F@`[I"	to_s;T@W[;[[;[[[U:RDoc::Context::Section[i0o;;[;	0;
0[@
I"lib/pp.rb;T@O@OcRDoc::TopLevel

Zerion Mini Shell 1.0