the library class is primarily a namespace for the Library::Version class to live in. it
contains a few usefull methods used to load libraries which have been
installed using versioning information. libraries installed in this was
will have paths like
lib/foo.rb.0.0.0
lib/foo.rb.2.1.1
and where
lib/foo.rb
would be a symbolic link to the latest version of the library. if one
wanted only the latest then the normal 'require' or 'load' should suffice,
but Library.link and Libray.load provide means
to specify a particular interface needed by your program.
| :filenmae |
[RW] |
|
| :version |
[RW] |
|
|
new(filename, version = nil)
|
# File lib/library.rb, line 25
def initialize(filename, version = nil)
unless version
@filename, @version = Version.parse(filename)
else
@filename, @version = filename, Version.new(version)
end
end
|
link(filename, interface=nil)
|
'require' a library which supports a certain interface note that, due to a
limitation in Kernel::require, this supports only *.rb files for the moment
eg.
Library::link 'yourmodule.rb', 0
Library::link 'yourmodule.rb.0.0.0'
Library::link 'yourmodule.rb', '0.1.0'
note that the interface argument, while a version string may be given for,
is only used to determine what interface is required
# File lib/library.rb, line 265
def link filename, interface=nil
Loader.instance.link (filename, interface)
end
|
load(filename, interface=nil)
|
loads a library which supports a certain interface note that, due to a
limitation in Kernel::require, this supports only *.rb files for the moment
eg.
Library::load 'yourmodule.rb', 0
Library::load 'yourmodule.rb.0.0.0'
Library::load 'yourmodule.rb', '0.1.0'
note that the interface argument, while a version string may be given for,
is only used to determine what interface is required
# File lib/library.rb, line 281
def load filename, interface=nil
Loader.instance.load (filename, interface)
end
# File lib/library.rb, line 33
def inspect
"#{filename}.#{version}"
end