Socket
Book a DemoInstallSign in
Socket

proc-to-lambda

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proc-to-lambda

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

proc-to-lambda

Build Status Gem Version Coverage Status

Introduction

Convert proc to lambda, retain the context.

Install

gem install 'proc-to-lambda'

Usage

You can use the method directly by invoke the method to_lambda of ProcToLambda.

my_proc = proc { return self + 1 }
my_lambda = ProcToLambda.to_lambda(my_proc)

# `return` works here, and can retain `self`
1.instance_exec(&my_lambda) # => 2

Or, you can include or extend the ProcToLambda module.

include ProcToLambda

def foo
  to_lambda(proc {})
end
# beware, this is risky.
Proc.extend(ProcTolambda)

Proc.to_lambda(proc {})

More

You can see also test cases.

FAQs

Package last updated on 19 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.