class Proc

Public Instance Methods

memoized() click to toggle source
# File lib/lab42/stream/proc.rb, line 2
def memoized
  already_run = false
  result      = nil
  ->{
    if already_run
      result
    else
      already_run = true
      result = call()
    end
  }
end
not() click to toggle source
# File lib/lab42/stream/proc.rb, line 15
def not
  -> (*args, &blk) {
    ! self.(*args, &blk)
  }
end