class Eye::Utils::AliveArray
Public Class Methods
new(arr = [])
click to toggle source
# File lib/eye/utils/alive_array.rb, line 8 def initialize(arr = []) @arr = arr end
Public Instance Methods
+(other)
click to toggle source
# File lib/eye/utils/alive_array.rb, line 36 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 47 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 12 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 20 def full_size @arr.size end
pure()
click to toggle source
# File lib/eye/utils/alive_array.rb, line 24 def pure @arr end
sort(&block)
click to toggle source
Calls superclass method
# File lib/eye/utils/alive_array.rb, line 32 def sort(&block) self.class.new super end
sort_by(&block)
click to toggle source
Calls superclass method
# File lib/eye/utils/alive_array.rb, line 28 def sort_by(&block) self.class.new super end
to_a()
click to toggle source
# File lib/eye/utils/alive_array.rb, line 16 def to_a map{|x| x } end