Class: Plugit::Environment
- Inherits:
-
Object
- Object
- Plugit::Environment
- Defined in:
- lib/plugit/environment.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #[](library_name) ⇒ Object
- #add_library(library) ⇒ Object
-
#initialize(name, description, root_path) ⇒ Environment
constructor
A new instance of Environment.
- #libraries ⇒ Object
- #library_root_path ⇒ Object
Constructor Details
#initialize(name, description, root_path) ⇒ Environment
Returns a new instance of Environment.
5 6 7 8 |
# File 'lib/plugit/environment.rb', line 5 def initialize(name, description, root_path) @name, @description, @root_path = name, description, root_path @libraries = [] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/plugit/environment.rb', line 3 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/plugit/environment.rb', line 3 def name @name end |
Instance Method Details
#[](library_name) ⇒ Object
10 11 12 |
# File 'lib/plugit/environment.rb', line 10 def [](library_name) @libraries.detect {|l|l.name == library_name} end |
#add_library(library) ⇒ Object
14 15 16 |
# File 'lib/plugit/environment.rb', line 14 def add_library(library) @libraries << library end |
#libraries ⇒ Object
18 19 20 |
# File 'lib/plugit/environment.rb', line 18 def libraries @libraries.dup end |
#library_root_path ⇒ Object
22 23 24 |
# File 'lib/plugit/environment.rb', line 22 def library_root_path File.join(@root_path, name.to_s) end |