Class: Chrysalis::Manifest
- Includes:
- Singleton
- Defined in:
- lib/chrysalis/manifest.rb
Overview
Contains an entry for each project included as a component of larger application or library.
Instance Method Summary collapse
-
#<<(proj) ⇒ Object
:nodoc:.
-
#[](key) ⇒ Object
Returns a Project if
key
is a url. -
#initialize ⇒ Manifest
constructor
:nodoc:.
Constructor Details
#initialize ⇒ Manifest
:nodoc:
32 33 34 |
# File 'lib/chrysalis/manifest.rb', line 32 def initialize # :nodoc: @projects = {} end |
Instance Method Details
#<<(proj) ⇒ Object
:nodoc:
45 46 47 48 49 50 |
# File 'lib/chrysalis/manifest.rb', line 45 def <<(proj) # :nodoc: key = Chrysalis::Loader.instance.loading raise ManifestError, "Project already exists in manifest. (URL: #{key})" if @projects[key] @projects[key] = proj end |
#[](key) ⇒ Object
Returns a Project if key
is a url. Returns a URL if key
is a Project.
The Manifest functions as a two-way hash, where either a URL or a Project can be used as a key, returning its associated value.
40 41 42 43 |
# File 'lib/chrysalis/manifest.rb', line 40 def [](key) return @projects.invert[key] if key.is_a?(Project) @projects[key] end |