Skip to content

Instantly share code, notes, and snippets.

@inem
Created April 12, 2009 10:07
Show Gist options
  • Save inem/93944 to your computer and use it in GitHub Desktop.
Save inem/93944 to your computer and use it in GitHub Desktop.
adding to_json method to ostruct
class OpenStruct
def to_json
table.to_json
end
end
o = OpenStruct.new
o.foo = "foo"
o.bar = 1
o.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment