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 =
{ # TODO }
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
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.
12 13 14 15 16 17 18 |
# File 'lib/lookbook/stores/input_store.rb', line 12 def initialize(config = nil) @store = {} config.to_h.each do |name, opts| add_input(name, opts[:partial], opts.except(:partial)) end end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
9 10 11 |
# File 'lib/lookbook/stores/input_store.rb', line 9 def store @store end |
Class Method Details
.default_config ⇒ Object
32 33 34 |
# File 'lib/lookbook/stores/input_store.rb', line 32 def self.default_config ConfigLoader.call(CONFIG_FILE) end |
.init_from_config ⇒ Object
28 29 30 |
# File 'lib/lookbook/stores/input_store.rb', line 28 def self.init_from_config new(default_config) end |
Instance Method Details
#add_input(input, *args) ⇒ Object
20 21 22 |
# File 'lib/lookbook/stores/input_store.rb', line 20 def add_input(input, *args) store[normalize_name(input)] = build_config(input, *args) end |
#get_input(input) ⇒ Object
24 25 26 |
# File 'lib/lookbook/stores/input_store.rb', line 24 def get_input(input) store[normalize_name(input)] end |