Class: Budgie::AutoArray
- Inherits:
-
Array
- Object
- Array
- Budgie::AutoArray
- Defined in:
- lib/budgie/auto_array.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(&block) ⇒ AutoArray
constructor
A new instance of AutoArray.
Constructor Details
#initialize(&block) ⇒ AutoArray
Returns a new instance of AutoArray.
5 6 7 8 |
# File 'lib/budgie/auto_array.rb', line 5 def initialize(&block) @block = block super end |
Instance Method Details
#[](index) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/budgie/auto_array.rb', line 10 def [](index) value = super if value.nil? populate index super else value end end |