lib/egp_rates/edbe.rb
def parse(raw_data)
      raw_data.each_with_object(sell: {}, buy: {}) do |row, result|
        next unless row.name[3] == 'B'
        currency    = row.name[0..2].to_sym
        action      = row.name[4..-1].to_sym
        action_rate = row.value.to_f
        action_rate = (action_rate * 100).round(4) if currency == :JPY

        result[action][currency] = action_rate
      end
    end
def parse(raw_data)
      raw_data.each_with_object(sell: {}, buy: {}) do |row, result|
        next unless row.name[3] == 'B'
        currency    = row.name[0..2].to_sym
        action      = row.name[4..-1].to_sym
        action_rate = row.value.to_f
        action_rate = (action_rate * 100).round(4) if currency == :JPY

        result[action][currency] = action_rate
      end
    end
def parse ( raw_data ) raw_data . each_with_object ( sell : { } , buy : { } ) do | row , result | next unless row . name [ 3 ] == 'B' currency = row . name [ 0 .. 2 ] . to_sym action = row . name [ 4 .. - 1 ] . to_sym action_rate = row . value . to_f action_rate = ( action_rate * 100 ) . round ( 4 ) if currency == :JPY result [ action ] [ currency ] = action_rate end end
Parse the #raw_exchange_rates returned in response
 @param [Array] of the raw_data scraped
 @return [Hash] of exchange rates for selling and buying
   {
     { sell: { SYM: rate }, { SYM: rate }, ... },
     { buy:  { SYM: rate }, { SYM: rate }, ... }
   }
Parse the #raw_exchange_rates returned in response