Class: Kiba::Uncommon::Destinations::Slack

Inherits:
Object
  • Object
show all
Defined in:
lib/kiba/uncommon/destinations/slack.rb

Overview

Very basic Slack destination

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slack_notifier) ⇒ Slack

Returns a new instance of Slack.



14
15
16
# File 'lib/kiba/uncommon/destinations/slack.rb', line 14

def initialize(slack_notifier)
  @notifier = slack_notifier
end

Instance Attribute Details

#notifierObject (readonly)

Returns the value of attribute notifier.



11
12
13
# File 'lib/kiba/uncommon/destinations/slack.rb', line 11

def notifier
  @notifier
end

Instance Method Details

#closeObject



29
30
31
# File 'lib/kiba/uncommon/destinations/slack.rb', line 29

def close
  # Nothing to do
end

#write(row) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/kiba/uncommon/destinations/slack.rb', line 19

def write(row)
  unless @headers_written
    @headers_written = true
    notifier.ping "`#{row.keys.join(',')}`"
  end
  
  notifier.ping row.values.join(',')
end