class Sshez::PrintingManager
Just a printing service that keeps track by all its output Mainly used for testing purposes
Attributes
output[R]
An attribute reader to store printing logs
Public Class Methods
new()
click to toggle source
# File lib/sshez/printing_manager.rb, line 11 def initialize @output = '' @verbose = false end
Public Instance Methods
clear!()
click to toggle source
Resets the printer for testing purposes
# File lib/sshez/printing_manager.rb, line 58 def clear! @output = '' @verbose = false end
output?()
click to toggle source
Did we print anything?
# File lib/sshez/printing_manager.rb, line 44 def output? !@output.empty? end
print(text)
click to toggle source
Adds to output then prints
# File lib/sshez/printing_manager.rb, line 19 def print(text) @output += %(#{text}\n) puts text end
prompt(text)
click to toggle source
Prompts for user input
# File lib/sshez/printing_manager.rb, line 35 def prompt(text) @output += %(#{text}\n) print text STDIN.gets end
verbose!()
click to toggle source
Let the flooding begin!
# File lib/sshez/printing_manager.rb, line 51 def verbose! @verbose = true end
verbose_print(text)
click to toggle source
Adds to output and prints only if verbose set to true
# File lib/sshez/printing_manager.rb, line 27 def verbose_print(text) @output += %(#{text}\n) puts text if @verbose end