Is there a simple way to load a class from a URL in Ruby? I’m looking for something analogous to Java’s URL class loader.
Example:
require ‘http://github.com/outoftime/sunspot/blob/master/lib/light_config.rb‘
- or –
require ‘http://www.codehost.com/application.tgz‘ (signed archive containing multiple files?)
I’m considering adding a custom function to load the classes from the URL, perform security checks, then call something like eval(..) – but this approach seems a bit odd.
http_require
There’s also a gem called urirequire. It appears to work:
http://yagni.com/bar.rb:
foo.rb: