Class: Dicey::CLI::VerbosePrinter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dicey/cli/verbose_printer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Prints verbose output to the given IO object.

Instance Method Summary collapse

Constructor Details

#initialize(verbosity, io = $stdout) ⇒ VerbosePrinter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of VerbosePrinter.



7
8
9
10
# File 'lib/dicey/cli/verbose_printer.rb', line 7

def initialize(verbosity, io = $stdout)
  @verbosity = verbosity || 0
  @io = io
end

Instance Method Details

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Prints the given message to the IO object if the verbosity level is greater than or equal to the minimum verbosity level.

Parameters:

  • message (String)
  • min_verbosity (Integer) (defaults to: 1)


17
18
19
# File 'lib/dicey/cli/verbose_printer.rb', line 17

def print(message, min_verbosity = 1)
  @io.puts message if @verbosity >= min_verbosity
end