Skip to content

Instantly share code, notes, and snippets.

@jmmastey
Created December 21, 2018 16:56
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 jmmastey/c17b1081c899821ddf1683addd731256 to your computer and use it in GitHub Desktop.
Save jmmastey/c17b1081c899821ddf1683addd731256 to your computer and use it in GitHub Desktop.
class Struct
# use the members of this struct to pull out hash keys in the right order
def self.from_hash(hash)
new(
*hash.symbolize_keys
.values_at(*members),
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment