Class: StatusPageRuby::Services::BuildStatsTable

Inherits:
Object
  • Object
show all
Defined in:
lib/status_page_ruby/services/build_stats_table.rb

Constant Summary collapse

HEADINGS =
['Service', 'Up since', 'Down time'].freeze
SECONDS_IN_MINUTE =
60
SECONDS_IN_HOUR =
3600
SECONDS_IN_DAY =
86_400

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_repository) ⇒ BuildStatsTable

Returns a new instance of BuildStatsTable.



11
12
13
# File 'lib/status_page_ruby/services/build_stats_table.rb', line 11

def initialize(status_repository)
  @status_repository = status_repository
end

Instance Attribute Details

#status_repositoryObject (readonly)

Returns the value of attribute status_repository.



9
10
11
# File 'lib/status_page_ruby/services/build_stats_table.rb', line 9

def status_repository
  @status_repository
end

Instance Method Details

#call(service = nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/status_page_ruby/services/build_stats_table.rb', line 15

def call(service = nil)
  Terminal::Table.new(
    headings: HEADINGS,
    rows: build_rows(service)
  ).to_s
end