Class: Hieracles::Outputs::Console

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/hieracles/outputs/console.rb

Overview

format accepting colors for display in the terminal

Constant Summary collapse

COLORS =
[
  "\e[31m%s\e[0m",
  "\e[32m%s\e[0m",
  "\e[33m%s\e[0m",
  "\e[34m%s\e[0m",
  "\e[35m%s\e[0m",
  "\e[37m%s\e[0m",
  "\e[38m%s\e[0m",
  "\e[36m%s\e[0m",
  "\e[97m%s\e[0m",
  "\e[35;1m%s\e[0m"
]

Instance Method Summary collapse

Methods included from Utils

#deep_sort, #local_merge, #local_merge!, #max_key_length, #sym_keys, #to_deep_hash, #to_shallow_hash

Constructor Details

#initializeConsole

Returns a new instance of Console.



23
24
25
# File 'lib/hieracles/outputs/console.rb', line 23

def initialize()
  @colors = {}
end

Instance Method Details

#hash_list(headers, hash) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/hieracles/outputs/console.rb', line 27

def hash_list(headers, hash)
  back = "\n"
  if headers.count > 0
    notifications.each do |v|
      back << format("#{COLORS[9]}\n", "*** #{v.source}: #{v.message} ***")
    end
    back << "\n"
  end
  
end