Module: Storazzo::Common
Constant Summary
Constants included
from Colors
Storazzo::Colors::PREPEND_ME
Instance Method Summary
collapse
Methods included from Colors
#azure, #blue, #deb2, #gray, #green, #orange, #pgreen, #pred, #purple, #pwhite, #pyellow, #red, #white, #yellow
Instance Method Details
#bug(s) ⇒ Object
64
65
66
|
# File 'lib/storazzo/common.rb', line 64
def bug(s)
puts "[π] #{gray s}"
end
|
#deb(s) ⇒ Object
42
43
44
45
|
# File 'lib/storazzo/common.rb', line 42
def deb(s)
puts "[DEBπ] #{yellow(s)}" if _debug_true end
|
#err(str) ⇒ Object
60
61
62
|
# File 'lib/storazzo/common.rb', line 60
def err(str)
puts "[ERRπ] #{red(str)}" end
|
#fatal(s) ⇒ Object
84
85
86
|
# File 'lib/storazzo/common.rb', line 84
def fatal(s)
raise "[FπTAL] #{red s}"
end
|
#if_deb? ⇒ Boolean
48
49
50
51
52
53
54
|
# File 'lib/storazzo/common.rb', line 48
def if_deb?
if _debug_true deb '== yield START =='
yield
deb '== yield END =='
end
end
|
#linux? ⇒ Boolean
92
93
94
|
# File 'lib/storazzo/common.rb', line 92
def linux?
`uname`.chomp == 'Linux'
end
|
#mac? ⇒ Boolean
88
89
90
|
# File 'lib/storazzo/common.rb', line 88
def mac?
`uname`.chomp == 'Darwin'
end
|
#ppp(complex_object_to_colorize) ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'lib/storazzo/common.rb', line 75
def ppp(complex_object_to_colorize)
if defined?(Pry::ColorPrinter)
Pry::ColorPrinter.pp(complex_object_to_colorize)
else
require 'pp'
pp complex_object_to_colorize
end
end
|
#pverbose(_is_verbose, str) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/storazzo/common.rb', line 68
def pverbose(_is_verbose, str)
return if ENV['RUBYOPT'] == '-W0'
puts "[π¦πππππ·πΈπ¦π¦π¦] #{gray str}" end
|
#slugify(string) ⇒ Object
96
97
98
|
# File 'lib/storazzo/common.rb', line 96
def slugify(string)
string.to_s.downcase.strip.gsub(/\s+/, '_').gsub(/[^\w-]/, '')
end
|
#warn(s) ⇒ Object
56
57
58
|
# File 'lib/storazzo/common.rb', line 56
def warn(s)
puts "[Wβ οΈRN] #{azure(s)}"
end
|