forked from voxpupuli/hiera-eyaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.rb
39 lines (34 loc) · 1.05 KB
/
options.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Hiera
module Backend
module Eyaml
class Options
def self.[]= key, value
@@options ||= {}
@@options[ key.to_sym ] = value
end
def self.[] key
@@options ||= {}
@@options[ key.to_sym ]
end
def self.set hash
@@options = {}
hash.each do |k, v|
@@options[ k.to_sym ] = v
end
end
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
end
end
end
end