Skip to content

Instantly share code, notes, and snippets.

@soulcutter
Created February 17, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soulcutter/56ef83c793495b7fc4a5 to your computer and use it in GitHub Desktop.
Save soulcutter/56ef83c793495b7fc4a5 to your computer and use it in GitHub Desktop.
Struct destructuring and keyword args
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