Sha256: d39a28fea5f6aa76196ab41041cc58a0ad4597fe9d2dea6cee4b3ef36d4f6d43

Contents?: true

Size: 260 Bytes

Versions: 5

Compression:

Stored size: 260 Bytes

Contents

class Object
  # Requires the specified argument but silently ignores any LoadErrors.
  def require_optional(*args)
    require(*args)
  rescue LoadError
    # that's fine, it's an optional require
  end
  alias_method :optional_require, :require_optional
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wagons-0.8.0 lib/wagons/extensions/require_optional.rb
wagons-0.7.0 lib/wagons/extensions/require_optional.rb
wagons-0.6.1 lib/wagons/extensions/require_optional.rb
wagons-0.6.0 lib/wagons/extensions/require_optional.rb
wagons-0.5.0 lib/wagons/extensions/require_optional.rb