class Eye::Utils::AliveArray

Public Class Methods

new(arr = []) click to toggle source
# File lib/eye/utils/alive_array.rb, line 9
def initialize(arr = [])
  @arr = arr
end

Public Instance Methods

+(other) click to toggle source
# File lib/eye/utils/alive_array.rb, line 41
def +(other)
  if other.is_a?(Eye::Utils::AliveArray)
    @arr += other.pure
  elsif other.is_a?(Array)
    @arr += other
  else
    raise "Unexpected + #{other}"
  end
  self
end
==(other) click to toggle source
# File lib/eye/utils/alive_array.rb, line 52
def ==(other)
  if other.is_a?(Eye::Utils::AliveArray)
    @arr == other.pure
  elsif other.is_a?(Array)
    @arr == other
  else
    raise "Unexpected == #{other}"
  end
end
each(&block) click to toggle source
# File lib/eye/utils/alive_array.rb, line 13
def each(&block)
  @arr.each { |elem| elem && elem.alive? && block[elem] }
end
full_size() click to toggle source
# File lib/eye/utils/alive_array.rb, line 21
def full_size
  @arr.size
end
pure() click to toggle source
# File lib/eye/utils/alive_array.rb, line 25
def pure
  @arr
end
sort(&block) click to toggle source
Calls superclass method
# File lib/eye/utils/alive_array.rb, line 33
def sort(&block)
  self.class.new super
end
sort!() click to toggle source
# File lib/eye/utils/alive_array.rb, line 37
def sort!
  @arr.sort!
end
sort_by(&block) click to toggle source
Calls superclass method
# File lib/eye/utils/alive_array.rb, line 29
def sort_by(&block)
  self.class.new super
end
to_a() click to toggle source
# File lib/eye/utils/alive_array.rb, line 17
def to_a
  map { |x| x }
end