Class: ResponseDecorator

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

Instance Method Summary collapse

Instance Method Details

#decorate_table(response, options = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/response_decorator.rb', line 4

def decorate_table response, options = {}
  @response = response
  @options = options
  return '# The list is empty' if response.empty?
  return '# ' + response[:errors] if response.include? :errors
  Terminal::Table.new headings: get_header, rows: get_rows
end