Class: Focus::STDOUT
- Inherits:
-
Object
- Object
- Focus::STDOUT
- Defined in:
- lib/focus/stdout.rb
Class Method Summary collapse
- .debug_output(str) ⇒ Object
- .print_line(str, opts = { quiet: false }) ⇒ Object
- .puts_line(str, opts = { quiet: false }) ⇒ Object
- .step(string, opts = { quiet: false }) ⇒ Object
- .title(string) ⇒ Object
Class Method Details
.debug_output(str) ⇒ Object
30 31 32 |
# File 'lib/focus/stdout.rb', line 30 def debug_output(str) ::STDOUT.puts str if $DEBUG end |
.print_line(str, opts = { quiet: false }) ⇒ Object
9 10 11 12 |
# File 'lib/focus/stdout.rb', line 9 def print_line(str, opts = { quiet: false }) quiet = opts[:quiet] ::STDOUT.print str unless quiet end |
.puts_line(str, opts = { quiet: false }) ⇒ Object
4 5 6 7 |
# File 'lib/focus/stdout.rb', line 4 def puts_line(str, opts = { quiet: false }) quiet = opts[:quiet] ::STDOUT.puts str unless quiet end |
.step(string, opts = { quiet: false }) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/focus/stdout.rb', line 14 def step(string, opts = { quiet: false }) quiet = opts[:quiet] print_line(Focus::Formatter.step(string), quiet: quiet) yield if block_given? puts_line Focus::Formatter.ok, quiet: quiet rescue FailedActionError, MissingConfiguration => error puts_line Focus::Formatter.error error.to_s end |
.title(string) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/focus/stdout.rb', line 23 def title(string) puts puts "-" * 50 puts string puts "-" * 50 end |