Module: WdiTf::Funcs

Defined in:
lib/wdi_tf/funcs.rb

Class Method Summary collapse

Class Method Details

.error(msg:, code: 1) ⇒ Object



20
21
22
23
# File 'lib/wdi_tf/funcs.rb', line 20

def error(msg:, code: 1)
    puts "\033[31mERROR: #{ msg }\033[0m"
    exit(code)
end

.info(msg) ⇒ Object



25
26
27
28
# File 'lib/wdi_tf/funcs.rb', line 25

def info(msg)
    color = (/^\s+/.match(msg)) ? 32 : 34
    puts "\033[1;30m[#{ Time.now.strftime("%Y.%m.%d %H:%M:%S") }] \033[#{ color }m#{ msg }\033[0m"
end

.set_verbose=(v) ⇒ Object



6
7
8
# File 'lib/wdi_tf/funcs.rb', line 6

def set_verbose=(v)
    @verbose = v
end

.verbose(msg) ⇒ Object



14
15
16
17
18
# File 'lib/wdi_tf/funcs.rb', line 14

def verbose(msg)
    if WdiTf::Funcs.verbose?
        info(msg)
    end
end

.verbose?Boolean



10
11
12
# File 'lib/wdi_tf/funcs.rb', line 10

def verbose?
    @verbose
end