class Yawast::Utilities

Public Class Methods

diff_text(txt1, txt2) click to toggle source
# File lib/util.rb, line 53
def self.diff_text(txt1, txt2)
  indent_text(Diffy::Diff.new(txt1, txt2, {context: 1}).to_s(:color))
end
indent_text(msg) click to toggle source
# File lib/util.rb, line 49
def self.indent_text(msg)
  msg.gsub!(/^/, "\t")
end
prompt(msg) click to toggle source
# File lib/util.rb, line 38
def self.prompt(msg)
  puts
  puts msg
  print '> '
  val = $stdin.gets.chomp.strip

  Yawast::Shared::Output.log_append_value 'prompt', msg, val

  val
end
puts_error(msg) click to toggle source
# File lib/util.rb, line 12
def self.puts_error(msg)
  puts_msg('[E]'.red, msg)
  Yawast::Shared::Output.log_append_value 'messages', 'error', msg
end
puts_info(msg) click to toggle source
# File lib/util.rb, line 27
def self.puts_info(msg)
  puts_msg('[I]'.green, msg)
  Yawast::Shared::Output.log_append_value 'messages', 'info', msg
end
puts_msg(type, msg) click to toggle source
# File lib/util.rb, line 8
def self.puts_msg(type, msg)
  puts "#{type} #{msg}"
end
puts_raw(msg = '') click to toggle source
# File lib/util.rb, line 32
def self.puts_raw(msg = '')
  puts msg

  Yawast::Shared::Output.log_append_value 'messages', 'raw', msg if msg != ''
end
puts_vuln(msg) click to toggle source
# File lib/util.rb, line 17
def self.puts_vuln(msg)
  puts_msg('[V]'.magenta, msg)
  Yawast::Shared::Output.log_append_value 'messages', 'vulnerability', msg
end
puts_warn(msg) click to toggle source
# File lib/util.rb, line 22
def self.puts_warn(msg)
  puts_msg('[W]'.yellow, msg)
  Yawast::Shared::Output.log_append_value 'messages', 'warning', msg
end