Method: Falsework::CliUtils.veputs

Defined in:
lib/falsework/cliutils.rb

.veputs(level, msg) ⇒ Object

level

Verbosity level.

msg

A message to print.

Don’t print msg with a newline if it contains NNL_MARK at the end.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/falsework/cliutils.rb', line 77

def self.veputs(level, msg)
  t = msg.dup
  
  nnl = false
  if t.match(/#{NNL_MARK}$/)
    t.sub!(/#{$&}/, '')
    nnl = true
  end

  if @@verbose >= level
    nnl ? print(t) : print("#{t}\n")
    $stdout.flush
  end
end