Class: Hexx::Storage::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Hexx::Storage::Base
- Defined in:
- lib/hexx/storage/base.rb
Overview
The container to load and store ROM
settings
Direct Known Subclasses
Instance Attribute Summary collapse
-
#root ⇒ String?
Returns the root of the application to #load settings from.
Instance Method Summary collapse
-
#[](repository) ⇒ Hexx::Storage::Repositories::Memory
Returns the object that stores settings for some repository.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#keys ⇒ Array<Symbol>
Returns the list of names for
ROM
repositories’. -
#load(file, env:) ⇒ undefined
Loads
ROM
settings from given yml file for given environment. -
#settings ⇒ Hash
Returns settings as an argument for
ROM.setup
. -
#setup(hash) ⇒ undefined
Sets
ROM
settings from hash.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
23 24 25 |
# File 'lib/hexx/storage/base.rb', line 23 def initialize super({}) end |
Instance Attribute Details
Instance Method Details
#[](repository) ⇒ Hexx::Storage::Repositories::Memory
Returns the object that stores settings for some repository
|
# File 'lib/hexx/storage/base.rb', line 32
|
#keys ⇒ Array<Symbol>
Returns the list of names for ROM
repositories’
|
# File 'lib/hexx/storage/base.rb', line 27
|
#load(file, env:) ⇒ undefined
Loads ROM
settings from given yml file for given environment
63 64 65 66 |
# File 'lib/hexx/storage/base.rb', line 63 def load(file, env:) check_root # need to know where to load the file from setup [root, file].to_path.from_file.from_yaml.sub(env) end |
#settings ⇒ Hash
Returns settings as an argument for ROM.setup
85 86 87 88 |
# File 'lib/hexx/storage/base.rb', line 85 def settings check_storage __getobj__.wrap(&:settings) end |
#setup(hash) ⇒ undefined
Sets ROM
settings from hash
75 76 77 78 |
# File 'lib/hexx/storage/base.rb', line 75 def setup(hash) check_root # need to know where to place logs to __setobj__ hash.normalize.wrap(&new_repo) end |