Method: Library::Domain#require

Defined in:
lib/library/domain.rb

#require(pathname, options = {}) ⇒ true, false

Require a feature from the library.

Parameters:

  • pathname (String)

    The pathname of feature relative to library’s loadpath.

  • options (Hash) (defaults to: {})

Returns:

  • (true, false)

    If feature was newly required or successfully loaded.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/library/domain.rb', line 133

def require(pathname, options={})
  if file = $LOAD_CACHE[pathname]
    if options[:load]
      return file.load
    else
      return false
    end
  end

  if feature = Library.find(pathname, options)
    #file.library_activate
    $LOAD_CACHE[pathname] = feature
    return feature.acquire(options)
  end

  # fallback to Ruby's own load mechinisms
  if options[:load]
    __load__(pathname, options[:wrap])
  else
    __require__(pathname)
  end
end