-
-
Save croaky/117919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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