Class: Ori::LazyArray
Constant Summary
collapse
- INIT =
proc { [] }
Instance Method Summary
collapse
#any?, #delete_if, #each, #empty?
Methods inherited from Lazy
#initialized?, #internal
Constructor Details
Returns a new instance of LazyArray.
47
48
49
|
# File 'lib/ori/lazy.rb', line 47
def initialize
super(INIT)
end
|
Instance Method Details
#[](index) ⇒ Object
51
52
53
|
# File 'lib/ori/lazy.rb', line 51
def [](index)
internal[index] if initialized?
end
|
#[]=(index, value) ⇒ Object
59
60
61
|
# File 'lib/ori/lazy.rb', line 59
def []=(index, value)
internal[index] = value
end
|
#push(value) ⇒ Object
Also known as:
<<
55
56
57
|
# File 'lib/ori/lazy.rb', line 55
def push(value)
internal.push(value)
end
|
#shift ⇒ Object
71
72
73
74
75
|
# File 'lib/ori/lazy.rb', line 71
def shift
return unless initialized?
internal.shift
end
|
#size ⇒ Object
65
66
67
68
69
|
# File 'lib/ori/lazy.rb', line 65
def size
return 0 unless initialized?
internal.size
end
|