Class: Lookbook::InputStore
- Inherits:
-
Object
- Object
- Lookbook::InputStore
- Defined in:
- lib/lookbook/stores/input_store.rb
Constant Summary collapse
- CONFIG_FILE =
"config/inputs.yml"
- DEFAULTS =
{}
Instance Attribute Summary collapse
- #store ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #add_input(input, *args) ⇒ Object
- #get_input(input) ⇒ Object
-
#initialize(config = nil) ⇒ InputStore
constructor
A new instance of InputStore.
Constructor Details
#initialize(config = nil) ⇒ InputStore
Returns a new instance of InputStore.
10 11 12 13 14 15 16 17 |
# File 'lib/lookbook/stores/input_store.rb', line 10 def initialize(config = nil) @store = {} config.to_h.each do |name, opts| opts[:system] = true add_input(name, opts[:partial], opts.except(:partial)) end end |
Instance Attribute Details
#store ⇒ Object (readonly)
7 8 9 |
# File 'lib/lookbook/stores/input_store.rb', line 7 def store @store end |
Class Method Details
.default_config ⇒ Object
31 32 33 |
# File 'lib/lookbook/stores/input_store.rb', line 31 def self.default_config ConfigLoader.call(CONFIG_FILE) end |
.init_from_config ⇒ Object
27 28 29 |
# File 'lib/lookbook/stores/input_store.rb', line 27 def self.init_from_config new(default_config) end |
Instance Method Details
#add_input(input, *args) ⇒ Object
19 20 21 |
# File 'lib/lookbook/stores/input_store.rb', line 19 def add_input(input, *args) store[normalize_name(input)] = build_config(input, *args) end |
#get_input(input) ⇒ Object
23 24 25 |
# File 'lib/lookbook/stores/input_store.rb', line 23 def get_input(input) store[normalize_name(input)] end |