Skip to content

Instantly share code, notes, and snippets.

@locks
Forked from tenderlove/blah.rb
Created June 19, 2014 16:57
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 locks/9ba30711dd66f51b2b1a to your computer and use it in GitHub Desktop.
Save locks/9ba30711dd66f51b2b1a 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