class FutureProof::FutureArray
FutureArray
should be used to raise exceptions if specific values are exception instances on a direct access with []
, first, last, each
, sort and so on.
Public Class Methods
new(arg)
click to toggle source
# File lib/future_proof/future_array.rb, line 10 def initialize(arg) @arry = Array.new arg end
Public Instance Methods
[](index)
click to toggle source
Acces FutureArray
value by index.
# File lib/future_proof/future_array.rb, line 15 def [](index) raise_or_value @arry[index] end
all()
click to toggle source
Array of values.
@note raises an exception if any value if an exception.
# File lib/future_proof/future_array.rb, line 22 def all map { |a| a } end
each() { |raise_or_value(a)| ... }
click to toggle source
Iterates through array elements.
@note raises an error if any value is an exception.
# File lib/future_proof/future_array.rb, line 35 def each @arry.each { |a| yield raise_or_value(a) } end