[前][次][番号順一覧][スレッド一覧]

ruby-changes:59354

From: Alan <ko1@a...>
Date: Sat, 21 Dec 2019 23:09:14 +0900 (JST)
Subject: [ruby-changes:59354] ddb6023d64 (master): Add spec for capturing Kernel#lambda with Kernel#method

https://git.ruby-lang.org/ruby.git/commit/?id=ddb6023d64

From ddb6023d64a8c96348b4e67603753e2916a04f28 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Mon, 15 Jul 2019 00:35:30 -0400
Subject: Add spec for capturing Kernel#lambda with Kernel#method


diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb
index 537ac26..5c30511 100644
--- a/spec/ruby/core/kernel/lambda_spec.rb
+++ b/spec/ruby/core/kernel/lambda_spec.rb
@@ -53,6 +53,13 @@ describe "Kernel.lambda" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/lambda_spec.rb#L53
     l.lambda?.should be_false
   end
 
+  it "does not create lambda-style Procs when captured with #method" do
+    kernel_lambda = method(:lambda)
+    l = kernel_lambda.call { 42 }
+    l.lambda?.should be_false
+    l.call(:extra).should == 42
+  end
+
   it "checks the arity of the call when no args are specified" do
     l = lambda { :called }
     l.call.should == :called
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]