class Array

reference iain.nl/going-crazy-with-to_proc

Public Instance Methods

>>(a) click to toggle source

prepend element a to the array (self)

# File lib/functions/shared/ext.rb, line 3
def >> a
  self.unshift a
end
to_proc() click to toggle source

converts the array into a Proc where the first element is the method name, other elements are the values

# 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