Files

Guard::Notifier::FileNotifier

Writes guard notification results to a file

@example Add the `:file` notifier to your `Guardfile`

notification :file, path: 'tmp/guard_result'

Constants

DEFAULTS

Default options for FileNotifier

Public Instance Methods

available?(silent = false, options = {}) click to toggle source

Test if the file notification option is available?

@param [Boolean] silent true if no error messages should be shown @param [Hash] options notifier options @return [Boolean] the availability status

# File lib/guard/notifiers/file_notifier.rb, line 23
def available?(silent = false, options = {})
  options.has_key?(:path)
end
notify(type, title, message, image, options = { }) click to toggle source

Write the notification to a file. By default it writes type, title, and message separated by newlines.

@param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify' @param [String] title the notification title @param [String] message the notification message body @param [String] image the path to the notification image @param [Hash] options additional notification library options @option options [String] format printf style format for file contents @option options [String] path the path of where to write the file

# File lib/guard/notifiers/file_notifier.rb, line 38
def notify(type, title, message, image, options = { })
  if options[:path]
    format = options.fetch(:format, DEFAULTS[:format])

    write(options[:path], format % [type, title, message])
  else
    ::Guard::UI.error ':file notifier requires a :path option'
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.