Class: Podrb::Commands::Podcasts::Output

Inherits:
BaseOutput
  • Object
show all
Defined in:
lib/podrb/commands/podcasts/output.rb

Instance Method Summary collapse

Methods inherited from BaseOutput

call, #initialize

Constructor Details

This class inherits a constructor from Podrb::Commands::BaseOutput

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/podrb/commands/podcasts/output.rb', line 7

def call
  case @context[:details]
  when :records_found
    text_table = generate_text_table(
      data: @context[:metadata][:records],
      columns: @context[:metadata][:columns]
    )
    <<~OUTPUT
      #{text_table}
    OUTPUT
  when :empty_table
    <<~OUTPUT
      No podcasts yet.
    OUTPUT
  when :invalid_column
    <<~OUTPUT
      This field is invalid: #{@context[:][:invalid_column]}
    OUTPUT
  end
end