Created
February 17, 2015 21:54
-
-
Save soulcutter/56ef83c793495b7fc4a5 to your computer and use it in GitHub Desktop.
Struct destructuring and keyword args
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
Flub = Struct.new(:foo, :bar) do | |
def to_hash; to_h; end | |
end | |
def named(foo:, bar:) | |
p "foo: #{foo}" | |
p "bar: #{bar}" | |
end | |
named(**Flub.new(1, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment