Module: Safeguard::Output::Terminal
- Defined in:
- lib/safeguard/output/terminal.rb
Overview
Encapsulates all terminal output.
Class Method Summary collapse
-
.after_hashing(file, function, hash) ⇒ Object
Prints a string after a file is hashed with a new line.
-
.after_verifying(file, function, result) ⇒ Object
Prints a string after a file is verified with a new line.
-
.before_hashing(file, function) ⇒ Object
Prints a string before a file is hashed without a new line.
-
.before_verifying(file, function) ⇒ Object
Prints a string before a file is verified without a new line.
-
.create_mappings_for(*keys) ⇒ Object
Creates an options ribbon containing containing mappings to this class’ methods.
- .initialized_repository(directory) ⇒ Object
-
.translate(key, *args) ⇒ Object
Appends the given
key
to this module’s translation key and forwards all other arguments toI18n.translate
.
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) = { file: file, function: function, hash: hash } puts translate(:after_hashing, preprocess()) 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 (file, function, result) = { file: file, function: function, result: result } puts translate(:after_verifying, preprocess()) 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) = { file: file, function: function } print translate(:before_hashing, preprocess()) 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 (file, function) = { file: file, function: function } print translate(:before_verifying, preprocess()) 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) = Ribbon.new keys.each { |key| [key] = method key } end |
.initialized_repository(directory) ⇒ Object
50 51 52 53 |
# File 'lib/safeguard/output/terminal.rb', line 50 def initialized_repository(directory) = { directory: directory } puts translate(:initialized_repository, preprocess()) 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 |