Module: Guard::Helpers::Formatter

Defined in:
lib/guard/helpers/formatter.rb

Class Method Summary collapse

Class Method Details

.debug(message, options = { }) ⇒ Object

Print a debug message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: { })

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



46
47
48
# File 'lib/guard/helpers/formatter.rb', line 46

def debug(message, options = { })
  ::Guard::UI.debug(message, options)
end

.error(message, options = { }) ⇒ Object

Print a red error message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: { })

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



56
57
58
# File 'lib/guard/helpers/formatter.rb', line 56

def error(message, options = { })
  ::Guard::UI.error(color(message, ';31'), options)
end

.info(message, options = { }) ⇒ Object

Print an info message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: { })

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



36
37
38
# File 'lib/guard/helpers/formatter.rb', line 36

def info(message, options = { })
  ::Guard::UI.info(message, options)
end

.notify(message, options = { }) ⇒ Object

Outputs a system notification.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: { })

    the output options

Options Hash (options):

  • :image (Symbol, String)

    the image to use, either :failed, :pending or :success, or an image path

  • :title (String)

    the title of the system notification



78
79
80
# File 'lib/guard/helpers/formatter.rb', line 78

def notify(message, options = { })
  ::Guard::Notifier.notify(message, options)
end

.success(message, options = { }) ⇒ Object

Print a green success message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: { })

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



66
67
68
69
# File 'lib/guard/helpers/formatter.rb', line 66

def success(message, options = { })
  stamped_message = "#{Time.now.strftime('%r')} #{message}"
  ::Guard::UI.info(color(stamped_message, ';32'), options)
end