Class: Pdfh::Settings
- Inherits:
-
Object
- Object
- Pdfh::Settings
- Defined in:
- lib/pdfh/models/settings.rb
Overview
Handles the config yaml data mapping, and associates a file name with a doc type
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#lookup_dirs ⇒ Object
readonly
Returns the value of attribute lookup_dirs.
Instance Method Summary collapse
- #document_type(id) ⇒ DocumentType
- #document_types ⇒ Array<DocumentType>
- #initialize(config_data) ⇒ self constructor
Constructor Details
#initialize(config_data) ⇒ self
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pdfh/models/settings.rb', line 10 def initialize(config_data) process_lookup_dirs(config_data[:lookup_dirs]) process_destination_base(config_data[:destination_base_path]) Pdfh.debug "Configured Look up directories:" lookup_dirs.each.with_index(1) { |dir, idx| Pdfh.debug " #{idx}. #{dir}" } Pdfh.debug load_doc_types(config_data[:document_types]) end |
Instance Attribute Details
#base_path ⇒ Object (readonly)
Returns the value of attribute base_path.
6 7 8 |
# File 'lib/pdfh/models/settings.rb', line 6 def base_path @base_path end |
#lookup_dirs ⇒ Object (readonly)
Returns the value of attribute lookup_dirs.
6 7 8 |
# File 'lib/pdfh/models/settings.rb', line 6 def lookup_dirs @lookup_dirs end |
Instance Method Details
#document_type(id) ⇒ DocumentType
27 28 29 |
# File 'lib/pdfh/models/settings.rb', line 27 def document_type(id) @document_types[id] end |
#document_types ⇒ Array<DocumentType>
22 23 24 |
# File 'lib/pdfh/models/settings.rb', line 22 def document_types @document_types.values end |