Top Level Namespace
Defined Under Namespace
Modules: Enumerable, Kernel, Webby Classes: ERB, Hash, String, Time
Instance Method Summary collapse
-
#try_require(lib, gemname = nil) ⇒ Object
call-seq: try_require( library, gemname = nil ) => true or false.
Instance Method Details
#try_require(lib, gemname = nil) ⇒ Object
call-seq:
try_require( library, gemname = nil ) => true or false
Try to laod the given library using the built-in require, but do not raise a LoadError if unsuccessful. Returns true
if the library was successfully loaded; returns false
otherwise.
If a gemname is given, then the “gem gemname” command will be called before the library is loaded.
220 221 222 223 224 225 226 |
# File 'lib/webby.rb', line 220 def try_require( lib, gemname = nil ) gem gemname unless gemname.nil? require lib true rescue LoadError false end |