Class: Tug::Slack
- Inherits:
-
Object
- Object
- Tug::Slack
- Defined in:
- lib/tug/notify/slack.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(options) ⇒ Slack
constructor
A new instance of Slack.
- #notify(text) ⇒ Object
Constructor Details
#initialize(options) ⇒ Slack
Returns a new instance of Slack.
6 7 8 |
# File 'lib/tug/notify/slack.rb', line 6 def initialize() @url = [:webhook_url] end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/tug/notify/slack.rb', line 4 def url @url end |
Instance Method Details
#notify(text) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/tug/notify/slack.rb', line 10 def notify(text) unless @url.nil? IO.popen("curl #{@url} -X POST -# #{params(text)}") do |pipe| puts pipe.read end end end |