Sha256: 2fa5b8d97a705e7b111b24867dd1cf63fbb753a4ac731c131afacae696164ec9

Contents?: true

Size: 444 Bytes

Versions: 4

Compression:

Stored size: 444 Bytes

Contents

class Eye::Utils::AliveArray
  extend Forwardable
  include Enumerable

  def_delegators :@arr, :[], :<<, :clear, :delete, :size, :empty?, :push, :flatten

  def initialize(arr = [])
    @arr = arr
  end

  def each(&block)
    @arr.each{|elem| elem && elem.alive? && block[elem] }
  end

  def to_a
    map{|x| x }
  end

  def full_size
    @arr.size
  end

  def pure
    @arr
  end

  def sort_by(&block)
    self.class.new super
  end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
reel-eye-0.3.1 lib/eye/utils/alive_array.rb
eye-0.3.1 lib/eye/utils/alive_array.rb
eye-0.3 lib/eye/utils/alive_array.rb
eye-0.2.4 lib/eye/utils/alive_array.rb