class Tailnudge::Notification

Public Class Methods

create(result) click to toggle source
# File lib/tailnudge/notification.rb, line 5
def self.create(result)
  new(result).run
end
new(result) click to toggle source
# File lib/tailnudge/notification.rb, line 9
def initialize(result)
  @result = result
end

Public Instance Methods

run() click to toggle source
# File lib/tailnudge/notification.rb, line 13
def run
  TerminalNotifier.notify(@result.message,
                          options)
end

Private Instance Methods

group_id() click to toggle source
# File lib/tailnudge/notification.rb, line 29
def group_id
  [
    Process.pid,
    @result.pattern_id
  ].join('-')
end
options() click to toggle source
# File lib/tailnudge/notification.rb, line 20
def options
  if Tailnudge.configuration[:all]
    Tailnudge.configuration
  else
    # Throttling by group
    Tailnudge.configuration.merge(group_id: group_id)
  end
end