cns 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@ module Cns
27
27
 
28
28
  # @return [Array<Hash>] lista ledger paymium novos
29
29
  def ledger
30
- @ledger ||= exd[:kl].map { |h| h[:account_operations].select { |o| kyl.include?(o[:uuid]) } }.flatten
30
+ @ledger ||= exd[:kl].map { |map| map[:account_operations].select { |obj| kyl.include?(obj[:uuid]) } }.flatten
31
31
  end
32
32
 
33
33
  # @return [String] texto saldos & transacoes & ajuste dias
@@ -40,7 +40,7 @@ module Cns
40
40
  mostra_ledger
41
41
  return unless ledger.count.positive?
42
42
 
43
- puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |e| "#{e}:0" }.join(' ')}")
43
+ puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |obj| "#{obj}:0" }.join(' ')}")
44
44
  end
45
45
 
46
46
  # @return [Hash] dados exchange paymium - saldos & transacoes ledger
@@ -53,22 +53,22 @@ module Cns
53
53
 
54
54
  # @return [Array<String>] lista txid dos ledger novos
55
55
  def kyl
56
- @kyl ||= exd[:kl].map { |h| h[:account_operations].map { |o| o[:uuid] } }.flatten -
57
- (ops[:t] ? [] : bqd[:nl].map { |e| e[:txid] })
56
+ @kyl ||= exd[:kl].map { |oex| oex[:account_operations].map { |obj| obj[:uuid] } }.flatten -
57
+ (ops[:t] ? [] : bqd[:nl].map { |obq| obq[:txid] })
58
58
  end
59
59
 
60
60
  # @example (see Apice#account_fr)
61
61
  # @param [Symbol] bqm symbol paymium da moeda
62
62
  # @return [String] texto formatado saldos
63
63
  def formata_saldos(bqm)
64
- b = bqd[:sl][bqm].to_d
65
- t = exd[:sl]["balance_#{bqm}".to_sym].to_d
64
+ vbq = bqd[:sl][bqm].to_d
65
+ vkr = exd[:sl]["balance_#{bqm}".to_sym].to_d
66
66
  format(
67
67
  '%<mo>-5.5s %<kr>21.9f %<bq>21.9f %<ok>3.3s',
68
68
  mo: bqm.upcase,
69
- kr: t,
70
- bq: b,
71
- ok: t == b ? 'OK' : 'NOK'
69
+ kr: vkr,
70
+ bq: vbq,
71
+ ok: vkr == vbq ? 'OK' : 'NOK'
72
72
  )
73
73
  end
74
74
 
@@ -90,16 +90,16 @@ module Cns
90
90
  # @param [Integer] max chars a mostrar
91
91
  # @return [String] texto formatado identificacor da ledger
92
92
  def formata_uuid(uid, max)
93
- i = Integer(max / 2)
94
- max < 7 ? 'erro' : "#{uid[0, i]}#{uid[-i..]}"
93
+ int = Integer(max / 2)
94
+ max < 7 ? 'erro' : "#{uid[0, int]}#{uid[-int..]}"
95
95
  end
96
96
 
97
97
  # @return [String] texto totais numero de transacoes
98
98
  def mostra_totais
99
- c = exd[:kl].map { |h| h[:account_operations].count }.flatten.inject(:+)
100
- d = bqd[:nl].count
99
+ vkl = exd[:kl].map { |obj| obj[:account_operations].count }.flatten.inject(:+)
100
+ vnl = bqd[:nl].count
101
101
 
102
- puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: c, d: d, o: c == d ? 'OK' : 'NOK')}")
102
+ puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: vkl, d: vnl, o: vkl == vnl ? 'OK' : 'NOK')}")
103
103
  end
104
104
 
105
105
  # @return [String] texto transacoes ledger
@@ -107,7 +107,7 @@ module Cns
107
107
  return unless ops[:v] && ledger.count.positive?
108
108
 
109
109
  puts("\nledger data hora tipo moeda quantidade")
110
- ledger.sort { |a, b| b[:created_at_int] <=> a[:created_at_int] }.each { |o| puts(formata_ledger(o)) }
110
+ ledger.sort { |ant, prx| prx[:created_at_int] <=> ant[:created_at_int] }.each { |obj| puts(formata_ledger(obj)) }
111
111
  end
112
112
  end
113
113
  end
@@ -27,19 +27,19 @@ module Cns
27
27
 
28
28
  # @return [Array<Hash>] lista ledger therock novos
29
29
  def ledger
30
- @ledger ||= exd[:kl].select { |o| kyl.include?(o[:id]) }
30
+ @ledger ||= exd[:kl].select { |obj| kyl.include?(obj[:id]) }
31
31
  end
32
32
 
33
33
  # @return [String] texto saldos & transacoes & ajuste dias
34
34
  def mostra_resumo
35
35
  puts("\nTHEROCK\ntipo therock bigquery")
36
- exd[:sl].each { |h| puts(formata_saldos(h)) }
36
+ exd[:sl].each { |obj| puts(formata_saldos(obj)) }
37
37
  mostra_totais
38
38
 
39
39
  mostra_ledger
40
40
  return unless ledger.count.positive?
41
41
 
42
- puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |e| "#{e}:0" }.join(' ')}")
42
+ puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |obj| "#{obj}:0" }.join(' ')}")
43
43
  end
44
44
 
45
45
  # @return [Hash] dados exchange therock - saldos & transacoes ledger
@@ -52,21 +52,22 @@ module Cns
52
52
 
53
53
  # @return [Array<String>] lista txid dos ledger novos
54
54
  def kyl
55
- @kyl ||= exd[:kl].map { |h| h[:id] } - (ops[:t] ? [] : bqd[:nl].map { |e| e[:txid] })
55
+ @kyl ||= exd[:kl].map { |oex| oex[:id] } - (ops[:t] ? [] : bqd[:nl].map { |obq| obq[:txid] })
56
56
  end
57
57
 
58
58
  # @example (see Apice#account_mt)
59
59
  # @param [Hash] hsl saldo therock da moeda
60
60
  # @return [String] texto formatado saldos
61
61
  def formata_saldos(hsl)
62
- b = bqd[:sl][hsl[:currency].downcase.to_sym].to_d
63
- k = hsl[:balance].to_d
62
+ cur = hsl[:currency]
63
+ vbq = bqd[:sl][cur.downcase.to_sym].to_d
64
+ vkr = hsl[:balance].to_d
64
65
  format(
65
66
  '%<mo>-5.5s %<kr>21.9f %<bq>21.9f %<ok>3.3s',
66
- mo: hsl[:currency].upcase,
67
- kr: k,
68
- bq: b,
69
- ok: k == b ? 'OK' : 'NOK'
67
+ mo: cur.upcase,
68
+ kr: vkr,
69
+ bq: vbq,
70
+ ok: vkr == vbq ? 'OK' : 'NOK'
70
71
  )
71
72
  end
72
73
 
@@ -86,18 +87,18 @@ module Cns
86
87
 
87
88
  # @return [String] texto totais numero de transacoes
88
89
  def mostra_totais
89
- c = exd[:kl].count
90
- d = bqd[:nl].count
90
+ vkl = exd[:kl].count
91
+ vnl = bqd[:nl].count
91
92
 
92
- puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: c, d: d, o: c == d ? 'OK' : 'NOK')}")
93
+ puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: vkl, d: vnl, o: vkl == vnl ? 'OK' : 'NOK')}")
93
94
  end
94
95
 
95
96
  # @return [String] texto transacoes ledger
96
97
  def mostra_ledger
97
98
  return unless ops[:v] && ledger.count.positive?
98
99
 
99
- puts("\nledger data hora tipo moeda ---------quantidade")
100
- ledger.sort { |a, b| b[:id] <=> a[:id] }.each { |o| puts(formata_ledger(o)) }
100
+ puts("\nledger data hora tipo moeda quantidade")
101
+ ledger.sort { |ant, prx| prx[:id] <=> ant[:id] }.each { |obj| puts(formata_ledger(obj)) }
101
102
  end
102
103
  end
103
104
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cns
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2020-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: solargraph
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +174,7 @@ extensions: []
160
174
  extra_rdoc_files: []
161
175
  files:
162
176
  - ".gitignore"
177
+ - ".reek.yml"
163
178
  - ".rubocop.yml"
164
179
  - ".travis.yml"
165
180
  - CODE_OF_CONDUCT.md