Class: HoneyFormat::CLIResultWriter
- Inherits:
-
Object
- Object
- HoneyFormat::CLIResultWriter
- Defined in:
- lib/honey_format/cli/result_writer.rb
Overview
CLI result writer handles command output
Instance Attribute Summary collapse
-
#verbose ⇒ true, false
the writer mode.
Instance Method Summary collapse
-
#initialize(verbose: false) ⇒ CLIResultWriter
constructor
Instantiate the result writer.
-
#print(string, verbose: false) ⇒ Object
Print the string.
-
#puts(string, verbose: false) ⇒ Object
Puts the string.
-
#verbose? ⇒ true, false
Return if verbose mode is true/false.
Constructor Details
#initialize(verbose: false) ⇒ CLIResultWriter
Instantiate the result writer
12 13 14 |
# File 'lib/honey_format/cli/result_writer.rb', line 12 def initialize(verbose: false) @verbose = verbose end |
Instance Attribute Details
#verbose ⇒ true, false
the writer mode
6 7 8 |
# File 'lib/honey_format/cli/result_writer.rb', line 6 def verbose @verbose end |
Instance Method Details
#print(string, verbose: false) ⇒ Object
Print the string
25 26 27 28 29 |
# File 'lib/honey_format/cli/result_writer.rb', line 25 def print(string, verbose: false) return if !verbose? && verbose Kernel.print(string) end |
#puts(string, verbose: false) ⇒ Object
Puts the string
34 35 36 37 38 |
# File 'lib/honey_format/cli/result_writer.rb', line 34 def puts(string, verbose: false) return if !verbose? && verbose Kernel.puts(string) end |
#verbose? ⇒ true, false
Return if verbose mode is true/false
18 19 20 |
# File 'lib/honey_format/cli/result_writer.rb', line 18 def verbose? @verbose end |