Skip to content

Instantly share code, notes, and snippets.

@bil-bas
Created July 5, 2011 15:22
Show Gist options
  • Save bil-bas/1065047 to your computer and use it in GitHub Desktop.
Save bil-bas/1065047 to your computer and use it in GitHub Desktop.
binaryloader
app_path = __FILE__.chomp(File.extname(__FILE__))
binary_extensions = %w[.bundle .so]
binary_extensions.unshift ".#{RUBY_VERSION[0..2]}.so" if defined? RUBY_VERSION
found = binary_extensions.any? do |extension|
file = "#{app_path}#{extension}"
if File.exist? file
require file
true
else
false
end
end
raise "Failed to find binary library to load" unless found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment