lib/core/facets/indexable.rb in facets-2.9.3 vs lib/core/facets/indexable.rb in facets-3.0.0

- old
+ new

@@ -1,18 +1,18 @@ # Indexable is a mixin that provides index based methods, -# working soley with four methods: #index, #slice, #splice +# working solely with four methods: #index, #slice, #splice # and #size. # # These methods work in harmony. Where #index returns a # position of a given element, #slice returns elements # for given positions. #splice is like #slice but replaces -# the given position with new values. This mehtod is not +# the given position with new values. This method is not # part of ruby core, but it generally just an alias for #[]=, # just as #slice is an alias of #[]. #size of course simply # returns the total length of the indexable object. # -# NOTE: To test the folowing methods Indexable needs to be +# NOTE: To test the following methods Indexable needs to be # included into Array and array must have #splice defined. # # require 'facets/array/splice' # # class ::Array @@ -47,11 +47,11 @@ # def foot slice(-1,1) end - # Returns an array of the first element upto, + # Returns an array of the first element up to, # but not including, the last element. # # [1,2,3].body #=> [1,2] # #-- @@ -72,11 +72,11 @@ # [1,2,3,4,5,6].mid(-2) #=> 2 # [1,2,3,4,5,6].mid(1) #=> 5 # # In other words, If there are an even number of elements the # higher-indexed of the two center elements is indexed as - # orgin (0). + # origin (0). # def mid(offset=0) slice((size / 2) + offset) end @@ -101,10 +101,10 @@ else slice(i, 1 + (2 * birth)) end end - # Fetch values from a start index thru an end index. + # Fetch values from a start index through an end index. # # [1,2,3,4,5].thru(0,2) #=> [1,2,3] # [1,2,3,4,5].thru(2,4) #=> [3,4,5] # # [1,2,3,4,5].thru(2) #=> [1,2,3]