Module: ContextSpook::VerbosePuts

Included in:
Generator, Generator::Context
Defined in:
lib/context_spook/verbose_puts.rb

Overview

The VerbosePuts module provides a conditional output mechanism for displaying status or debug messages.

This module includes a method that outputs messages to standard error only when a verbose flag is enabled. It is designed to be included in classes that need to conditionally emit verbose logging information during processing.

Instance Method Summary collapse

Instance Method Details

#verbose_puts(*a) ⇒ nil

The verbose_puts method outputs the given arguments to standard error only if verbose mode is enabled.

This method serves as a conditional output mechanism, allowing debug or status messages to be displayed based on the verbosity setting of the object.

Parameters:

  • a (Array)

    the arguments to be printed to standard error

Returns:

  • (nil)

    always returns nil after attempting to output



20
21
22
23
# File 'lib/context_spook/verbose_puts.rb', line 20

def verbose_puts(*a)
  verbose or return
  STDERR.puts(a)
end