Class: Hiera::Backend::Eyaml::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/hiera/backend/eyaml/options.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object


11
12
13
14
# File 'lib/hiera/backend/eyaml/options.rb', line 11

def self.[] key
  @@options ||= {}
  @@options[ key.to_sym ]
end

.[]=(key, value) ⇒ Object


6
7
8
9
# File 'lib/hiera/backend/eyaml/options.rb', line 6

def self.[]= key, value
  @@options ||= {}
  @@options[ key.to_sym ] = value
end

.set(hash) ⇒ Object


16
17
18
19
20
21
# File 'lib/hiera/backend/eyaml/options.rb', line 16

def self.set hash
  @@options = {}
  hash.each do |k, v|
    @@options[ k.to_sym ] = v
  end
end

.traceObject


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hiera/backend/eyaml/options.rb', line 23

def self.trace
  LoggingHelper::trace "Dump of eyaml tool options dict:"
  LoggingHelper::trace "--------------------------------"
  @@options.each do |k, v|
    begin
      LoggingHelper::trace sprintf "%18s %-18s = %18s %-18s", "(#{k.class.name})", k.to_s, "(#{v.class.name})", v.to_s
    rescue
      LoggingHelper::trace sprintf "%18s %-18s = %18s %-18s", "(#{k.class.name})", k.to_s, "(#{v.class.name})", "<unprintable>" # case where v is binary
    end
  end
  LoggingHelper::trace "--------------------------------"
end