1 module ActiveSupport
#:nodoc:
2 module CoreExtensions
#:nodoc:
4 # Makes it easier to access parts of an array.
6 # Returns the tail of the array from +position+.
8 # %w( a b c d ).from(0) # => %w( a b c d )
9 # %w( a b c d ).from(2) # => %w( c d )
10 # %w( a b c d ).from(10) # => nil
11 # %w().from(0) # => nil
16 # Returns the beginning of the array up to +position+.
18 # %w( a b c d ).to(0) # => %w( a )
19 # %w( a b c d ).to(2) # => %w( a b c )
20 # %w( a b c d ).to(10) # => %w( a b c d )
21 # %w().to(0) # => %w()
26 # Equal to <tt>self[1]</tt>.
31 # Equal to <tt>self[2]</tt>.
36 # Equal to <tt>self[3]</tt>.
41 # Equal to <tt>self[4]</tt>.
46 # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit".