Class: Spectre::Resources::ResourceCollection
- Defined in:
- lib/spectre/resources.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add(name, path) ⇒ Object
-
#initialize ⇒ ResourceCollection
constructor
A new instance of ResourceCollection.
Constructor Details
#initialize ⇒ ResourceCollection
Returns a new instance of ResourceCollection.
8 9 10 |
# File 'lib/spectre/resources.rb', line 8 def initialize @items = {} end |
Instance Method Details
#[](name) ⇒ Object
16 17 18 19 20 |
# File 'lib/spectre/resources.rb', line 16 def [] name raise "Resource with name '#{name}' does not exist" unless @items.key? name @items[name] end |
#add(name, path) ⇒ Object
12 13 14 |
# File 'lib/spectre/resources.rb', line 12 def add name, path @items[name] = path end |