Class: Plugit::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/plugit/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/plugit/environment.rb', line 3

def description
  @description
end

#nameObject (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

#librariesObject



18
19
20
# File 'lib/plugit/environment.rb', line 18

def libraries
  @libraries.dup
end

#library_root_pathObject



22
23
24
# File 'lib/plugit/environment.rb', line 22

def library_root_path
  File.join(@root_path, name.to_s)
end