Created
January 10, 2021 05:20
-
-
Save baweaver/4e5e67278f2a00d4c34ff4c0d649053c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Either | |
def self.deconstruct_keys(*) | |
{ Right: Right, Left: Left } | |
end | |
class Right < Struct.new(:value); end | |
class Left < Struct.new(:value); end | |
end | |
Either => { Right:, Left: } | |
# Current: | |
# | |
# SyntaxError ((irb):62: key must be valid as local variables) | |
# Either in { Right:, Left: } | |
# ^~~~~~ | |
# Proposed: | |
[Right, Left] | |
# => [Either::Right, Either::Left] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment