Class: LicenseFinder::Printer
- Inherits:
-
Object
- Object
- LicenseFinder::Printer
- Defined in:
- lib/license_finder/printer.rb
Instance Attribute Summary collapse
-
#padding ⇒ Object
Returns the value of attribute padding.
Instance Method Summary collapse
-
#initialize ⇒ Printer
constructor
:nodoc:.
- #prepare_message(message, *color) ⇒ Object
- #say(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/)) ⇒ Object
-
#set_color(string) ⇒ Object
:nodoc:.
- #stdout ⇒ Object
Constructor Details
#initialize ⇒ Printer
:nodoc:
7 8 9 10 11 12 |
# File 'lib/license_finder/printer.rb', line 7 def initialize # :nodoc: @base = nil @mute = false @padding = 0 @always_force = false end |
Instance Attribute Details
#padding ⇒ Object
Returns the value of attribute padding.
5 6 7 |
# File 'lib/license_finder/printer.rb', line 5 def padding @padding end |
Instance Method Details
#prepare_message(message, *color) ⇒ Object
22 23 24 25 |
# File 'lib/license_finder/printer.rb', line 22 def (, *color) spaces = ' ' * padding spaces + set_color(.to_s, *color) end |
#say(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/)) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/license_finder/printer.rb', line 14 def say( = '', color = nil, force_new_line = (.to_s !~ /( |\t)\Z/)) buffer = (, *color) buffer << "\n" if force_new_line && !.to_s.end_with?("\n") stdout.print(buffer) stdout.flush end |
#set_color(string) ⇒ Object
:nodoc:
27 28 29 |
# File 'lib/license_finder/printer.rb', line 27 def set_color(string, *) # :nodoc: string end |
#stdout ⇒ Object
35 36 37 |
# File 'lib/license_finder/printer.rb', line 35 def stdout $stdout end |