Skip to content

Instantly share code, notes, and snippets.

@kisoku
Created August 30, 2009 06:20
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 kisoku/177878 to your computer and use it in GitHub Desktop.
Save kisoku/177878 to your computer and use it in GitHub Desktop.
def attributes_print(a)
if a =~ /^(\w+)((\[:\w+\])+)/
field = "@data['#{$1}']" + $2
JSON.pretty_generate(eval(field))
else
JSON.pretty_generate(@data[a])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment