Class: Pdfh::Settings

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(config_data) ⇒ self

Parameters:

  • config_data (Hash)


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_pathObject (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_dirsObject (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

Returns:



27
28
29
# File 'lib/pdfh/models/settings.rb', line 27

def document_type(id)
  @document_types[id]
end

#document_typesArray<DocumentType>

Returns:



22
23
24
# File 'lib/pdfh/models/settings.rb', line 22

def document_types
  @document_types.values
end