Class: Notifaction::Type::Base
- Inherits:
-
Object
- Object
- Notifaction::Type::Base
- Defined in:
- lib/notifaction/type.rb
Constant Summary collapse
- OK =
Exit code to indicate everything is ok!
0
- QUIT =
Exit code to indicate a force quit (exit) call, meaning the program quit with an error
1
- 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
2
Instance Attribute Summary collapse
-
#user_conf ⇒ Object
readonly
Returns the value of attribute user_conf.
Instance Method Summary collapse
- #fire_hooks(payload) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #ok ⇒ Object
- #quit ⇒ Object
- #quit_ok ⇒ Object
- #quit_soft ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
21 22 23 24 |
# File 'lib/notifaction/type.rb', line 21 def initialize @user_conf = Notifaction::Cfg.new @style = Notifaction::Style.new end |
Instance Attribute Details
#user_conf ⇒ Object (readonly)
Returns the value of attribute user_conf.
8 9 10 |
# File 'lib/notifaction/type.rb', line 8 def user_conf @user_conf end |
Instance Method Details
#fire_hooks(payload) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# 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 |