Class: Lode::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Lode::Configuration
- Defined in:
- lib/lode/configuration.rb
Overview
Models the default configuration.
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
-
#registry ⇒ Object
Returns the value of attribute registry.
-
#store ⇒ Object
Returns the value of attribute store.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(store: PStore, mode: :default, table: Tables::Dictionary, primary_key: PRIMARY_KEY, registry: {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #register(key, model: Hash, primary_key: PRIMARY_KEY) ⇒ Object
- #store_for(path) ⇒ Object
- #table_for(store, key, setting: Setting.new) ⇒ Object
Constructor Details
#initialize(store: PStore, mode: :default, table: Tables::Dictionary, primary_key: PRIMARY_KEY, registry: {}) ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 |
# File 'lib/lode/configuration.rb', line 11 def initialize store: PStore, mode: :default, table: Tables::Dictionary, primary_key: PRIMARY_KEY, registry: {} super end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode
7 8 9 |
# File 'lib/lode/configuration.rb', line 7 def mode @mode end |
#primary_key ⇒ Object
Returns the value of attribute primary_key
7 8 9 |
# File 'lib/lode/configuration.rb', line 7 def primary_key @primary_key end |
#registry ⇒ Object
Returns the value of attribute registry
7 8 9 |
# File 'lib/lode/configuration.rb', line 7 def registry @registry end |
#store ⇒ Object
Returns the value of attribute store
7 8 9 |
# File 'lib/lode/configuration.rb', line 7 def store @store end |
#table ⇒ Object
Returns the value of attribute table
7 8 9 |
# File 'lib/lode/configuration.rb', line 7 def table @table end |
Instance Method Details
#register(key, model: Hash, primary_key: PRIMARY_KEY) ⇒ Object
25 26 27 28 |
# File 'lib/lode/configuration.rb', line 25 def register key, model: Hash, primary_key: PRIMARY_KEY registry[key] = Setting[model:, primary_key:] self end |
#store_for(path) ⇒ Object
19 |
# File 'lib/lode/configuration.rb', line 19 def store_for(path) = store.with(path, mode:) |