Class: Exrt::Cli::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/exrt/cli/format.rb

Class Method Summary collapse

Class Method Details

.history(response) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/exrt/cli/format.rb', line 16

def self.history(response)
  rows = []
  response['rates'].each do |date, rates|
    row = [date]
    rates.each do |symbol, rate|
      row.prepend(symbol, rate)
    end

    rows.append(row)
  end

  rows
end

.latest(response) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/exrt/cli/format.rb', line 7

def self.latest(response)
  rows = []
  response['rates'].each do |symbol, value|
    rows.append([symbol, value])
  end

  rows
end