You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2026. It is now read-only.
Library, as the name make clear, objectifies the concept of a Ruby library,
which naturally means the underlying API has a Library class.
The basics of the Library API are fairly simple. Given a location on disc
that houses a Ruby library, e.g. projects/hello, a new Library instance
can be created like any other object, using new.
mylib=Library.new('projects/hello')
With a library object in hand, we can require or load files from that library.
mylib.require'world'
Or look at information about the library.
mylib.name#=> 'hello'mylib.version#=> '1.0.0'
Crating a library object vianew gives us a one-off object. But to persist
the library and make it available by name in the global Ledger, we can use
instance constructor instead.
Library.instance('projects/hello')
Or, delving down a bit deeper into the belly of system, one could simply
feed the path to the master Ledger instance.
$LEDGER << 'projects/hello'
Both have the same exact effect. Our library will then be available via
Library's various look-up methods. There are a few of these. One of these is
the Kernel method library.
library('hello')
Another is Library.[] class method.
Library['hello']
There are many other useful Library methods, see the API Documentation for additional details.