-
-
Save johnkpaul/0779fcd65ba27b6949385fa0c8838862 to your computer and use it in GitHub Desktop.
Why do global methods in the repl end up inside private methods of lambdas?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.2.1 :001 > def test_method | |
2.2.1 :002?> puts 'test' | |
2.2.1 :003?> end | |
=> :test_method | |
2.2.1 :004 > l = -> { puts 'lambda' } | |
=> #<Proc:0x007fc7ca113a20@(irb):4 (lambda)> | |
2.2.1 :005 > l.private_methods.include? :l | |
=> false | |
2.2.1 :006 > l.private_methods.include? :test_method | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment