class Notifaction::Type::Base

Constants

OK

Exit code to indicate everything is ok!

QUIT

Exit code to indicate a force quit (exit) call, meaning the program quit with an error

QUIT_SOFT

Exit code to indicate that the program exited with a non-zero exit code, but not one that resulted in a force quit

Attributes

user_conf[R]

Public Class Methods

new() click to toggle source

@since 0.3.0.1

# File lib/notifaction/type.rb, line 21
def initialize
  @user_conf = Notifaction::Cfg.new
  @style = Notifaction::Style.new
end

Public Instance Methods

fire_hooks(payload) click to toggle source

@since 0.3.0

# File lib/notifaction/type.rb, line 52
def fire_hooks(payload)
  mux = Mutex.new

  th = Thread.new do
    mux.synchronize do
      hooks = @user_conf.hooks

      return if hooks.nil?

      hooks.each do |uri|
        uri = URI.parse(uri)

        response = Net::HTTP.post_form(uri, payload)
        response.code.to_i < 300
      end
    end
  end.join.exit

  th.status == false
end
ok() click to toggle source

@since 0.4.1

# File lib/notifaction/type.rb, line 40
def ok
  OK
end
quit() click to toggle source

@since 0.2.8

# File lib/notifaction/type.rb, line 28
def quit
  exit(QUIT)
end
quit_ok() click to toggle source

@since 0.4.1

# File lib/notifaction/type.rb, line 46
def quit_ok
  exit(OK)
end
quit_soft() click to toggle source

@since 0.4.1

# File lib/notifaction/type.rb, line 34
def quit_soft
  QUIT_SOFT
end