Class: TimeOverlap::Presenter

Inherits:
Object
  • Object
show all
Defined in:
lib/time_overlap/presenter.rb

Constant Summary collapse

AM =
"AM "
PM =
" PM"
NOON =
" 12:00 "
SIX_AM =
" 6:00 "
SIX_PM =
" 6:00 "
EARLY_BIRD =
'Early Bird'
NIGHT_OWL =
'Night Owl'
WIDTH =
102
AVAILABLE_SLOT =
"|█| "
EMPTY_SLOT =
"[ ] "

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, format = '%T%:z') ⇒ Presenter

Returns a new instance of Presenter.



21
22
23
24
# File 'lib/time_overlap/presenter.rb', line 21

def initialize(data, format = '%T%:z')
  @data   = data
  @format = format
end

Class Method Details

.generate_output(*args) ⇒ Object



26
27
28
# File 'lib/time_overlap/presenter.rb', line 26

def self.generate_output(*args)
  new(*args).generate_output
end

Instance Method Details

#generate_outputObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/time_overlap/presenter.rb', line 30

def generate_output
  rows = []

  rows << [base_content]
  rows << [min_overlap_content]
  rows << [full_overlap_content]

  table = Terminal::Table.new :rows => rows
  puts table

  @data
end