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

Version Path
ruco-0.0.42 lib/ruco/core_ext/array.rb
ruco-0.0.41 lib/ruco/core_ext/array.rb
ruco-0.0.40 lib/ruco/core_ext/array.rb
ruco-0.0.39 lib/ruco/core_ext/array.rb
ruco-0.0.38 lib/ruco/core_ext/array.rb
ruco-0.0.37 lib/ruco/core_ext/array.rb
ruco-0.0.36 lib/ruco/core_ext/array.rb
ruco-0.0.35 lib/ruco/core_ext/array.rb
ruco-0.0.34 lib/ruco/core_ext/array.rb
ruco-0.0.33 lib/ruco/core_ext/array.rb
ruco-0.0.32 lib/ruco/core_ext/array.rb
ruco-0.0.31 lib/ruco/core_ext/array.rb
ruco-0.0.30 lib/ruco/core_ext/array.rb
ruco-0.0.29 lib/ruco/core_ext/array.rb
ruco-0.0.28 lib/ruco/core_ext/array.rb
ruco-0.0.27 lib/ruco/core_ext/array.rb
ruco-0.0.26 lib/ruco/core_ext/array.rb
ruco-0.0.25 lib/ruco/core_ext/array.rb
ruco-0.0.24 lib/ruco/core_ext/array.rb
ruco-0.0.23 lib/ruco/core_ext/array.rb