Class: Timeprice::CLI::Presenters::Sources

Inherits:
Object
  • Object
show all
Defined in:
lib/timeprice/cli/presenters/sources.rb

Overview

Renders the sources list in compact-table, verbose, and JSON formats.

Constant Summary collapse

MAX_SOURCE_NAME =
60

Instance Method Summary collapse

Constructor Details

#initialize(list, verbose: false) ⇒ Sources

Returns a new instance of Sources.



10
11
12
13
# File 'lib/timeprice/cli/presenters/sources.rb', line 10

def initialize(list, verbose: false)
  @list = list
  @verbose = verbose
end

Instance Method Details

#json_hashObject



15
16
17
# File 'lib/timeprice/cli/presenters/sources.rb', line 15

def json_hash
  @list
end

#text_linesObject



19
20
21
# File 'lib/timeprice/cli/presenters/sources.rb', line 19

def text_lines
  @verbose ? verbose_lines : table_lines
end