Skip to content

Instantly share code, notes, and snippets.

@ka8725
Created January 16, 2016 23:28
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 ka8725/7fbb7612ab7260e840ab to your computer and use it in GitHub Desktop.
Save ka8725/7fbb7612ab7260e840ab to your computer and use it in GitHub Desktop.
params = {a: 1, b: "2", n: {c: 3}}
struct = Magic.new(params)
struct.a # => 1
struct.b # => "2"
struct.c # => undefined method "c"
struct[] # => undefined method "[]"
struct.a = 2 # => undefined method "a ="
struct.n.c # => 3
struct.n.d # => undefined method "d"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment