RobertDober/lab42_streams

View on GitHub
lib/lab42/stream/proc.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Proc
  def memoized
    already_run = false
    result      = nil
    ->{
      if already_run
        result
      else
        already_run = true
        result = call()
      end
    }
  end

  def not
    -> (*args, &blk) {
      ! self.(*args, &blk)
    }
  end
end