Class: ConfigMapper::ConfigDict::Factory
- Inherits:
-
Object
- Object
- ConfigMapper::ConfigDict::Factory
- Defined in:
- lib/config_mapper/config_dict.rb
Instance Attribute Summary collapse
-
#entry_factory ⇒ Object
readonly
Returns the value of attribute entry_factory.
-
#key_validator ⇒ Object
readonly
Returns the value of attribute key_validator.
Instance Method Summary collapse
- #config_doc ⇒ Object
-
#initialize(entry_factory, key_validator) ⇒ Factory
constructor
A new instance of Factory.
- #new ⇒ Object
Constructor Details
#initialize(entry_factory, key_validator) ⇒ Factory
Returns a new instance of Factory.
13 14 15 16 |
# File 'lib/config_mapper/config_dict.rb', line 13 def initialize(entry_factory, key_validator) @entry_factory = ConfigMapper::Factory.resolve(entry_factory) @key_validator = ConfigMapper::Validator.resolve(key_validator) end |
Instance Attribute Details
#entry_factory ⇒ Object (readonly)
Returns the value of attribute entry_factory.
18 19 20 |
# File 'lib/config_mapper/config_dict.rb', line 18 def entry_factory @entry_factory end |
#key_validator ⇒ Object (readonly)
Returns the value of attribute key_validator.
19 20 21 |
# File 'lib/config_mapper/config_dict.rb', line 19 def key_validator @key_validator end |
Instance Method Details
#config_doc ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/config_mapper/config_dict.rb', line 25 def config_doc return {} unless entry_factory.respond_to?(:config_doc) {}.tap do |result| entry_factory.config_doc.each do |path, doc| result["[X]#{path}"] = doc end end end |
#new ⇒ Object
21 22 23 |
# File 'lib/config_mapper/config_dict.rb', line 21 def new ConfigDict.new(@entry_factory, @key_validator) end |