Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/functions/prelude_lambda/ext.rb,
lib/functions/shared/ext.rb
Overview
reference iain.nl/going-crazy-with-to_proc
Instance Method Summary collapse
-
#>>(a) ⇒ Object
prepend element a to the array (self).
-
#to_proc ⇒ Object
converts the array into a Proc where the first element is the method name, other elements are the values.
Instance Method Details
#>>(a) ⇒ Object
prepend element a to the array (self)
3 4 5 |
# File 'lib/functions/shared/ext.rb', line 3 def >> a self.unshift a end |
#to_proc ⇒ Object
converts the array into a Proc where the first element is the method name, other elements are the values
6 7 8 9 |
# File 'lib/functions/prelude_lambda/ext.rb', line 6 def to_proc head, *tail = *self Proc.new { |obj, *other| obj.__send__(head, *(other + tail)) } end |