Class: Pdfmdconfig

Inherits:
Pdfmd
  • Object
show all
Defined in:
lib/pdfmd/pdfmdconfig.rb

Overview

Class: Pdfmdconfig

Show current default configuration of pdfmd

Instance Attribute Summary

Attributes inherited from Pdfmd

#filename, #logfile, #logstatus

Instance Method Summary collapse

Methods inherited from Pdfmd

#check_metatags, #metadata, #readUserInput, #read_metatags

Methods included from Pdfmdmethods

#determineValidSetting, #log, #queryHiera

Constructor Details

#initialize(filename) ⇒ Pdfmdconfig

Returns a new instance of Pdfmdconfig.



9
10
11
12
# File 'lib/pdfmd/pdfmdconfig.rb', line 9

def initialize(filename)
  super(filename)
  @filename = filename
end

Instance Method Details

#show_config(key = '') ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pdfmd/pdfmdconfig.rb', line 14

def show_config(key = '')

  if key.empty?
    self.log('debug','Showing current configuration in yaml format.')
    @hieradata.to_yaml
  elsif @hieradata.has_key?(key)
    self.log('debug',"Showing current configuration in yaml format, section: #{key}.")
    @hieradata[key].to_yaml
  else
    self.log('error',"Unknown Hiera Key used: '#{key}'.")
    puts 'Unknown hiera key. Abort.'
    abort
  end

end