Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/functions/prelude_lambda/ext.rb,
lib/functions/shared/ext.rb

Overview

Instance Method Summary collapse

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_procObject

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