Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/invokable/array.rb
Overview
Extend core Array by adding #to_proc which will enable arrays to be treated as functions of their indexes.
Instance Method Summary collapse
-
#to_proc ⇒ Proc
Return a proc that takes the index of the array and returns the value at that index or nil if there is no value at the given index.
Instance Method Details
#to_proc ⇒ Proc
Return a proc that takes the index of the array and returns the value at that index or nil if there is no value at the given index.
8 9 10 11 12 |
# File 'lib/invokable/array.rb', line 8 def to_proc lambda do |index| at(index) end end |