Sha256: 37b0702883fbe95f5b641ad7018a5e1944382953434ee010eacdc8b9295f3c00
Contents?: true
Size: 694 Bytes
Versions: 14
Compression:
Stored size: 694 Bytes
Contents
class Array # Returns the tail of the array from +position+. # # %w( a b c d ).from(0) # => ["a", "b", "c", "d"] # %w( a b c d ).from(2) # => ["c", "d"] # %w( a b c d ).from(10) # => [] # %w().from(0) # => [] def from(position) self[position, length] || [] end # Returns the beginning of the array up to +position+. # # %w( a b c d ).to(0) # => ["a"] # %w( a b c d ).to(2) # => ["a", "b", "c"] # %w( a b c d ).to(10) # => ["a", "b", "c", "d"] # %w().to(0) # => [] def to(position) first position + 1 end # Equal to <tt>self[1]</tt>. # # %w( a b c d e ).second # => "b" def second self[1] end end
Version data entries
14 entries across 14 versions & 2 rubygems