Class: AnimalCracker::MemoryAssetHost
- Inherits:
-
Hash
- Object
- Hash
- AnimalCracker::MemoryAssetHost
- Defined in:
- lib/animalcracker/asset_host.rb
Overview
Basically, a hash of pathnames to file-contents. Useful for testing, but maybe even other things.
Instance Method Summary collapse
- #find(path_to_asset) ⇒ Object
-
#initialize(database = nil) ⇒ MemoryAssetHost
constructor
A new instance of MemoryAssetHost.
- #store(path_to_asset, contents) ⇒ Object
Constructor Details
#initialize(database = nil) ⇒ MemoryAssetHost
Returns a new instance of MemoryAssetHost.
41 42 43 44 |
# File 'lib/animalcracker/asset_host.rb', line 41 def initialize(database=nil) super() update(database || {}) end |
Instance Method Details
#find(path_to_asset) ⇒ Object
46 47 48 |
# File 'lib/animalcracker/asset_host.rb', line 46 def find(path_to_asset) self[path_to_asset] || raise(NotFound, "Could not find #{path_to_asset}") end |
#store(path_to_asset, contents) ⇒ Object
50 |
# File 'lib/animalcracker/asset_host.rb', line 50 def store(path_to_asset, contents) self[path_to_asset] = contents; end |