Class: Pairity::PairSaver

Inherits:
Object
  • Object
show all
Defined in:
lib/pairity/pair_saver.rb

Instance Method Summary collapse

Constructor Details

#initialize(pairs) ⇒ PairSaver

Returns a new instance of PairSaver.



3
4
5
# File 'lib/pairity/pair_saver.rb', line 3

def initialize(pairs)
  @pairs = pairs
end

Instance Method Details

#post_to_slackObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pairity/pair_saver.rb', line 7

def post_to_slack
  rows = []
  @pairs.each_with_index do |pair, index|
    col = []
    col << "Room ##{index+1}"
    col << pair[0]
    col << pair[1]
    rows << col
  end
  table = Terminal::Table.new headings: ["Room","Driver","Navigator"], rows: rows
  Slackbot.new.post("```#{table.to_s}```")
end