Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created June 19, 2014 16:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tenderlove/958999ab4240b93bd3cd to your computer and use it in GitHub Desktop.
Save tenderlove/958999ab4240b93bd3cd to your computer and use it in GitHub Desktop.
# Make sure to do detection so it will gracefully downgrade like:
# begin
require 'psych'
Psych.add_domain_type(nil, 'code') { |_,hash|
p hash['ruby']
}
# rescue
# do 1.8 stuff
# end
Psych.load DATA.read
__END__
---
lambda: !code
ruby: 'proc { "world" }'
perl: 'sub { "world" }'
js: 'function() { return "world" }'
php: 'return "world";'
python: 'lambda: "world"'
clojure: '(fn [] "world")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment