class Notiffany::Notifier::File
Writes notifications to a file.
Constants
- DEFAULTS
Private Instance Methods
_check_available(opts = {})
click to toggle source
@param [Hash] opts some options @option opts [Boolean] path the path to a file where notification
message will be written
# File lib/notiffany/notifier/file.rb, line 16 def _check_available(opts = {}) fail UnavailableError, "No :path option given" unless opts[:path] end
_gem_name()
click to toggle source
# File lib/notiffany/notifier/file.rb, line 39 def _gem_name nil end
_perform_notify(message, opts = {})
click to toggle source
Writes the notification to a file. By default it writes type, title, and message separated by newlines.
@param [String] message the notification message body @param [Hash] opts additional notification library options @option opts [String] type the notification type. Either ‘success’,
'pending', 'failed' or 'notify'
@option opts [String] title the notification title @option opts [String] image the path to the notification image @option opts [String] format printf style format for file contents @option opts [String] path the path of where to write the file
# File lib/notiffany/notifier/file.rb, line 32 def _perform_notify(message, opts = {}) fail UnavailableError, "No :path option given" unless opts[:path] str = format(opts[:format], opts[:type], opts[:title], message) ::File.write(opts[:path], str) end