Skip to content

Instantly share code, notes, and snippets.

@croaky
Forked from foca/cascade.rb
Created May 26, 2009 06:12
Show Gist options
  • Save croaky/117919 to your computer and use it in GitHub Desktop.
Save croaky/117919 to your computer and use it in GitHub Desktop.
# Standard cascade of JSON dependencies.
# Cascades from fastest performing & hardest dependency management (odd C libraries)
# to slowest performing & easiest dependency management (pure Ruby)
# Meant for libraries like TwitterSearch & LeGit
def cascade_require(*libs)
require libs.shift.to_s
rescue LoadError
libs.empty? ? raise : retry
end
cascade_require 'yajl-ruby', 'json', 'json_pure'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment