Skip to content

Instantly share code, notes, and snippets.

@toretore
Created February 28, 2012 10: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 toretore/1931773 to your computer and use it in GitHub Desktop.
Save toretore/1931773 to your computer and use it in GitHub Desktop.
class JSFunction
def initialize(f)
@f = f
end
def to_json(*a, &b)
@f
end
end
puts JSON.generate({:foo => 'bar', :aFunction => JSFunction.new('function(){ return "foo"; }')})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment