lib/github_cli/formatters/table.rb in github_cli-0.5.3 vs lib/github_cli/formatters/table.rb in github_cli-0.5.4
- old
+ new
@@ -68,12 +68,11 @@
end
# Builds output array from response hash
#
def build_output
- case response
- when Array
+ if response.respond_to?(:to_ary)
case transform
when :horizontal
array = [flatten_hash(response[0].to_hash).keys]
response.each do |item|
array << convert_values(flatten_hash(item.to_hash).values)
@@ -86,10 +85,10 @@
rows.each {|row| array << row }
@total_records = rows.size
array
end
end
- when Hash
+ elsif response.respond_to?(:to_hash)
output = flatten_hash(response)
case transform
when :horizontal
array = [output.keys]
array << convert_values(output.values)