Sha256: 1ee21f5211336df4cce28e09356521457d58243d3dcf60cd453ad9e8eed22a2e
Contents?: true
Size: 557 Bytes
Versions: 20
Compression:
Stored size: 557 Bytes
Contents
# http://snippets.dzone.com/posts/show/5119 class Array def map_with_index! each_with_index do |e, idx| self[idx] = yield(e, idx); end end def map_with_index(&block) dup.map_with_index!(&block) end end # TODO move this to cursor <-> use cursor for calculations class Array def between?(a,b) self.>= a and self.<= b end def <(other) (self.<=>other) == -1 end def <=(other) self.<(other) or self.==other end def >(other) (self.<=>other) == 1 end def >=(other) self.>(other) or self.==other end end
Version data entries
20 entries across 20 versions & 1 rubygems