Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ruby / usr / share / ri / 2.2.0 / system / Range / cdesc-Range.ri
Size: Mime:
U:RDoc::NormalClass[iI"
Range:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"(Range serialization/deserialization;T:
@fileI"#ext/json/lib/json/add/range.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o;	;[
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;;[;
@R;0I"range.c;T[[I"
class;T[[:public[[I"json_create;FI"#ext/json/lib/json/add/range.rb;T[I"new;T@Z[:protected[[:private[[I"
instance;T[[;[[I"==;T@Z[I"===;T@Z[I"as_json;F@c[I"
begin;T@Z[I"bsearch;T@Z[I"cover?;T@Z[I"	each;T@Z[I"end;T@Z[I"	eql?;T@Z[I"exclude_end?;T@Z[I"
first;T@Z[I"	hash;T@Z[I"
include?;T@Z[I"inspect;T@Z[I"	last;T@Z[I"max;T@Z[I"member?;T@Z[I"min;T@Z[I"	size;T@Z[I"	step;T@Z[I"to_json;F@c[I"	to_s;T@Z[;[[;[[[U:RDoc::Context::Section[i0o;;[;
0;0[@I"lib/pp.rb;T@R@RcRDoc::TopLevel