Class: Enviera::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/enviera/options.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



10
11
12
13
# File 'lib/enviera/options.rb', line 10

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

.[]=(key, value) ⇒ Object



5
6
7
8
# File 'lib/enviera/options.rb', line 5

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

.set(hash) ⇒ Object



15
16
17
18
19
20
# File 'lib/enviera/options.rb', line 15

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

.traceObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/enviera/options.rb', line 22

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