class Object - webby-0.9.4 Documentation

# class Object

### Public Instance Methods

try_require( library, gemname = nil ) → true or false click to toggle source

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.

    # File lib/webby.rb, line 142
    def try_require( lib, gemname = nil )
      gem gemname unless gemname.nil?
      require lib
      true
    rescue LoadError
      false
    end