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



59
60
61
# File 'lib/storazzo/common.rb', line 59

def bug(s)
  puts "[πŸ›] #{gray s}"
end

#deb(s) ⇒ Object



37
38
39
40
# File 'lib/storazzo/common.rb', line 37

def deb(s)
  # useless: put logic in _debug_true() # return if ENV['RUBYOPT'] == "-W0"
  puts "[DEBπŸ‘€] #{yellow(s)}" if _debug_true # $DEBUG
end

#err(_str) ⇒ Object



55
56
57
# File 'lib/storazzo/common.rb', line 55

def err(_str)
  puts "[ERRπŸ‘Ž] #{red(s)}" # β›”
end

#fatal(s) ⇒ Object



75
76
77
# File 'lib/storazzo/common.rb', line 75

def fatal(s)
  raise "[FπŸ’€TAL] #{red s}"
end

#if_deb?Boolean

this has a yield

Returns:

  • (Boolean)


43
44
45
46
47
48
49
# File 'lib/storazzo/common.rb', line 43

def if_deb?
  if _debug_true # $DEBUG
    deb '== yield START =='
    yield
    deb '== yield END =='
  end
end

#linux?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/storazzo/common.rb', line 83

def linux?
  `uname`.chomp == 'Linux'
end

#mac?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/storazzo/common.rb', line 79

def mac?
  `uname`.chomp == 'Darwin'
end

#ppp(complex_object_to_colorize) ⇒ Object



70
71
72
73
# File 'lib/storazzo/common.rb', line 70

def ppp(complex_object_to_colorize)
  # TODO: i need to learn to return without printing..
  Pry::ColorPrinter.pp(complex_object_to_colorize)
end

#pverbose(_is_verbose, str) ⇒ Object



63
64
65
66
67
68
# File 'lib/storazzo/common.rb', line 63

def pverbose(_is_verbose, str)
  # puts "[VπŸ“šRBπŸ’€SπŸ“š] #{gray str}"
  return if ENV['RUBYOPT'] == '-W0'

  puts "[πŸ¦‹πŸ›πŸπŸžπŸœπŸ•·πŸ•ΈπŸ¦‚πŸ¦—πŸ¦Ÿ] #{gray str}" # insects: http://xahlee.info/comp/unicode_insects.html
end

#warn(s) ⇒ Object



51
52
53
# File 'lib/storazzo/common.rb', line 51

def warn(s)
  puts "[W⚠️RN] #{azure(s)}"
end