Module: Safeguard::Output::Terminal

Defined in:
lib/safeguard/output/terminal.rb

Overview

Encapsulates all terminal output.

Class Method Summary collapse

Class Method Details

.after_hashing(file, function, hash) ⇒ Object

Prints a string after a file is hashed with a new line.



31
32
33
34
# File 'lib/safeguard/output/terminal.rb', line 31

def after_hashing(file, function, hash)
  options = { file: file, function: function, hash: hash }
  puts translate(:after_hashing, preprocess(options))
end

.after_verifying(file, function, result) ⇒ Object

Prints a string after a file is verified with a new line.



37
38
39
40
# File 'lib/safeguard/output/terminal.rb', line 37

def after_verifying(file, function, result)
  options = { file: file, function: function, result: result }
  puts translate(:after_verifying, preprocess(options))
end

.before_hashing(file, function) ⇒ Object

Prints a string before a file is hashed without a new line.



25
26
27
28
# File 'lib/safeguard/output/terminal.rb', line 25

def before_hashing(file, function)
  options = { file: file, function: function }
   print translate(:before_hashing, preprocess(options))
end

.before_verifying(file, function) ⇒ Object

Prints a string before a file is verified without a new line.



19
20
21
22
# File 'lib/safeguard/output/terminal.rb', line 19

def before_verifying(file, function)
  options = { file: file, function: function }
  print translate(:before_verifying, preprocess(options))
end

.create_mappings_for(*keys) ⇒ Object

Creates an options ribbon containing containing mappings to this class’ methods.



44
45
46
47
48
# File 'lib/safeguard/output/terminal.rb', line 44

def create_mappings_for(*keys)
  options = Ribbon.new
  keys.each { |key| options[key] = method key }
  options
end

.initialized_repository(directory) ⇒ Object



50
51
52
53
# File 'lib/safeguard/output/terminal.rb', line 50

def initialized_repository(directory)
  options = { directory: directory }
  puts translate(:initialized_repository, preprocess(options))
end

.translate(key, *args) ⇒ Object

Appends the given key to this module’s translation key and forwards all other arguments to I18n.translate.



14
15
16
# File 'lib/safeguard/output/terminal.rb', line 14

def translate(key, *args)
  I18n.t translation_key(key), *args
end