Sha256: d1b2c7571cae4ce35d6fc1a24eaa44b3c353ca87d3c8e8fe25630962be6cd278
Contents?: true
Size: 1.96 KB
Versions: 4
Compression:
Stored size: 1.96 KB
Contents
# frozen_string_literal: true # @author Hernani Rodrigues Vaz module Eost # (see Carteiras) class Carteiras # @param [Hash] hjn dados juntos bigquery & eosscan # @return [String] texto formatado duma carteira def formata_carteira(hjn) format( '%<s1>-12.12s %<v1>12.4f %<v2>12.4f %<nn>3i %<ok>-3s', s1: hjn[:ax], v1: hjn[:bs], v2: hjn[:es], nn: hjn[:nn].count, ok: hjn[:ok] ? 'OK' : 'NOK' ) end # @param [Hash] htx transacao # @return [String] texto formatado transacao def formata_transacao(htx) format( '%<bn>9i %<fr>-12.12s %<to>-12.12s %<ac>-12.12s %<dt>10.10s %<vl>13.4f %<sy>-6.6s', bn: htx['block_num'], fr: act_data(htx)['from'], to: act_data(htx)['to'], ac: htx['action_trace']['act']['name'], dt: Date.parse(htx['block_time']), vl: act_data(htx)['quantity'].to_d, sy: act_data(htx)['quantity'][/[[:upper:]]+/] ) end # @param (see formata_transacao) # @return [Hash] dados da acao def act_data(htx) htx['action_trace']['act']['data'] end # @return [String] texto carteiras & transacoes & ajuste dias def mostra_resumo return unless djn.count.positive? puts("\naddress --bigquery-- --eosscans-- new") djn.each { |e| puts(formata_carteira(e)) } mostra_transacoes_novas mostra_configuracao_ajuste_dias end # @return [String] texto transacoes def mostra_transacoes_novas return unless ops[:v] && novas.count.positive? puts("\nblock num add from add to accao ---data--- ----valor----") novas_sort.each { |e| puts(formata_transacao(e)) } end # @return [String] texto configuracao ajuste dias das transacoes def mostra_configuracao_ajuste_dias return unless novas.count.positive? puts("\nstring ajuste dias\n-h=#{novas_sort.map { |e| "#{e['block_num']}:0" }.join(' ')}") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eost-0.1.12 | lib/eost/formatar.rb |
eost-0.1.11 | lib/eost/formatar.rb |
eost-0.1.10 | lib/eost/formatar.rb |
eost-0.1.8 | lib/eost/formatar.rb |