cryptum 0.0.299 → 0.0.300

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31bb1be404e033b5f8dc0a6328b87a0886391dbece2f0a45de1dcb99a008a8d6
4
- data.tar.gz: 7c29c160444a175d19d765266b2bd3413aa8c50b6d9d81585dded46a3c0db23b
3
+ metadata.gz: 19aa4531bc18105b33a4e294230aa649eb60f69dddea8b8e8a5c64b107781613
4
+ data.tar.gz: 71516512ef74f2037c9f7b5ae8e70df307f00f53d73b4f72ace120020e63af64
5
5
  SHA512:
6
- metadata.gz: 1e9c4360cd1ecc19beceb4401d5d14eadc755d5565e74a37d5c4e09397b091e851cdb92e5d18009700184cc2f902d86dd7ac8e18ac7180e290361a682ea50261
7
- data.tar.gz: d35c2cfbaec55bfc7055b6a8528b7d9021e8a56652f2418da824eda700b089e1d47644f122262bcb7b45b7f4177853af747ead21aa244f0a830b371d4f18e28a
6
+ metadata.gz: 6a06306a25bd98e0c5ccd50c7b061a918b56a468bb2c410ab2abd16a87991e705c4d895defc14dc584234baeb9d7611ec601f9615fc7f4edb9c75b086bd37921
7
+ data.tar.gz: 644274e3531d55bd71b1c37d6ed3795a54271c78c57c9d8eecf6168e7d881539a043cc36aa4c60edef97881a5eee86cd4e92bf250c9153f502073a86a1561ad7
data/.rubocop.yml CHANGED
@@ -3,6 +3,22 @@ AllCops:
3
3
  NewCops: enable
4
4
  Layout:
5
5
  Max: 3000
6
+ Layout/LineLength:
7
+ Max: 256
8
+ Metrics/AbcSize:
9
+ Max: 512
10
+ Metrics/BlockLength:
11
+ Max: 256
12
+ Metrics/BlockNesting:
13
+ Max: 4
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 128
16
+ Metrics/MethodLength:
17
+ Max: 512
18
+ Metrics/ModuleLength:
19
+ Max: 1024
20
+ Metrics/PerceivedComplexity:
21
+ Max: 128
6
22
  Style/HashEachMethods:
7
23
  Enabled: true
8
24
  Style/HashSyntax:
data/.rubocop_todo.yml CHANGED
@@ -1,138 +1,15 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-12-08 22:50:47 UTC using RuboCop version 1.40.0.
3
+ # on 2022-12-08 23:26:36 UTC using RuboCop version 1.40.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentationWidth.
12
- # SupportedStyles: with_first_argument, with_fixed_indentation
13
- Layout/ArgumentAlignment:
14
- Exclude:
15
- - 'lib/cryptum/ui/order_execution.rb'
16
-
17
- # Offense count: 1
18
- # This cop supports safe autocorrection (--autocorrect).
19
- Layout/ClosingParenthesisIndentation:
20
- Exclude:
21
- - 'lib/cryptum/ui/order_execution.rb'
22
-
23
- # Offense count: 2
24
- # This cop supports safe autocorrection (--autocorrect).
25
- # Configuration parameters: AllowForAlignment.
26
- Layout/CommentIndentation:
27
- Exclude:
28
- - 'lib/cryptum/api.rb'
29
- - 'lib/cryptum/ui/order_execution.rb'
30
-
31
- # Offense count: 3
32
- # This cop supports safe autocorrection (--autocorrect).
33
- Layout/EmptyLineAfterGuardClause:
34
- Exclude:
35
- - 'lib/cryptum/ui/order_execution.rb'
36
-
37
- # Offense count: 1
38
- # This cop supports safe autocorrection (--autocorrect).
39
- Layout/EmptyLines:
40
- Exclude:
41
- - 'lib/cryptum/api.rb'
42
-
43
- # Offense count: 1
44
- # This cop supports safe autocorrection (--autocorrect).
45
- # Configuration parameters: EnforcedStyle, IndentationWidth.
46
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
47
- Layout/FirstArgumentIndentation:
48
- Exclude:
49
- - 'lib/cryptum/ui/order_execution.rb'
50
-
51
- # Offense count: 1
52
- # This cop supports safe autocorrection (--autocorrect).
53
- # Configuration parameters: EnforcedStyle.
54
- # SupportedStyles: normal, indented_internal_methods
55
- Layout/IndentationConsistency:
56
- Exclude:
57
- - 'lib/cryptum/api.rb'
58
-
59
- # Offense count: 1
60
- # This cop supports safe autocorrection (--autocorrect).
61
- # Configuration parameters: IndentationWidth, EnforcedStyle.
62
- # SupportedStyles: spaces, tabs
63
- Layout/IndentationStyle:
64
- Exclude:
65
- - 'lib/cryptum/ui/order_execution.rb'
66
-
67
- # Offense count: 2
68
- # This cop supports safe autocorrection (--autocorrect).
69
- # Configuration parameters: EnforcedStyle, IndentationWidth.
70
- # SupportedStyles: aligned, indented
71
- Layout/MultilineOperationIndentation:
72
- Exclude:
73
- - 'lib/cryptum/ui/order_execution.rb'
74
- - 'lib/cryptum/ui/ticker.rb'
75
-
76
- # Offense count: 1
77
- # This cop supports safe autocorrection (--autocorrect).
78
- # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
79
- # SupportedStylesForExponentOperator: space, no_space
80
- Layout/SpaceAroundOperators:
81
- Exclude:
82
- - 'lib/cryptum/ui/order_execution.rb'
83
-
84
- # Offense count: 13
85
- # This cop supports safe autocorrection (--autocorrect).
86
- # Configuration parameters: AllowInHeredoc.
87
- Layout/TrailingWhitespace:
88
- Exclude:
89
- - 'bin/cryptum-forecast'
90
- - 'lib/cryptum.rb'
91
- - 'lib/cryptum/api.rb'
92
- - 'lib/cryptum/ui/order_execution.rb'
93
- - 'lib/cryptum/ui/order_plan.rb'
94
- - 'lib/cryptum/ui/order_timer.rb'
95
-
96
- # Offense count: 87
9
+ # Offense count: 89
97
10
  Lint/UselessAssignment:
98
11
  Enabled: false
99
12
 
100
- # Offense count: 47
101
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
102
- Metrics/AbcSize:
103
- Max: 418
104
-
105
- # Offense count: 7
106
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
107
- # AllowedMethods: refine
108
- Metrics/BlockLength:
109
- Max: 144
110
-
111
- # Offense count: 4
112
- # Configuration parameters: CountBlocks.
113
- Metrics/BlockNesting:
114
- Max: 4
115
-
116
- # Offense count: 19
117
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
118
- Metrics/CyclomaticComplexity:
119
- Max: 75
120
-
121
- # Offense count: 68
122
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
123
- Metrics/MethodLength:
124
- Max: 406
125
-
126
- # Offense count: 17
127
- # Configuration parameters: CountComments, CountAsOne.
128
- Metrics/ModuleLength:
129
- Max: 539
130
-
131
- # Offense count: 20
132
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
133
- Metrics/PerceivedComplexity:
134
- Max: 78
135
-
136
13
  # Offense count: 5
137
14
  # This cop supports safe autocorrection (--autocorrect).
138
15
  # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
@@ -143,14 +20,6 @@ Style/ConditionalAssignment:
143
20
  - 'lib/cryptum/option.rb'
144
21
  - 'lib/cryptum/ui/order_execute_details.rb'
145
22
 
146
- # Offense count: 1
147
- # Configuration parameters: AllowedConstants.
148
- Style/Documentation:
149
- Exclude:
150
- - 'spec/**/*'
151
- - 'test/**/*'
152
- - 'bin/cryptum-forecast'
153
-
154
23
  # Offense count: 2
155
24
  # This cop supports unsafe autocorrection (--autocorrect-all).
156
25
  # Configuration parameters: EnforcedStyle.
@@ -160,73 +29,8 @@ Style/FloatDivision:
160
29
  - 'lib/cryptum/ui/order_plan.rb'
161
30
  - 'lib/cryptum/ui/portfolio.rb'
162
31
 
163
- # Offense count: 1
164
- # This cop supports safe autocorrection (--autocorrect).
165
- # Configuration parameters: EnforcedStyle, MinBodyLength.
166
- # SupportedStyles: skip_modifier_ifs, always
167
- Style/Next:
168
- Exclude:
169
- - 'lib/cryptum/api.rb'
170
-
171
- # Offense count: 3
172
- # This cop supports safe autocorrection (--autocorrect).
173
- # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
174
- Style/NumericLiterals:
175
- MinDigits: 7
176
-
177
- # Offense count: 2
178
- # This cop supports unsafe autocorrection (--autocorrect-all).
179
- # Configuration parameters: Methods.
180
- Style/RedundantArgument:
181
- Exclude:
182
- - 'lib/cryptum/ui/command.rb'
183
-
184
32
  # Offense count: 2
185
33
  # This cop supports safe autocorrection (--autocorrect).
186
34
  Style/RedundantAssignment:
187
35
  Exclude:
188
36
  - 'lib/cryptum/api.rb'
189
-
190
- # Offense count: 1
191
- # This cop supports safe autocorrection (--autocorrect).
192
- # Configuration parameters: AllowMultipleReturnValues.
193
- Style/RedundantReturn:
194
- Exclude:
195
- - 'lib/cryptum.rb'
196
-
197
- # Offense count: 1
198
- # This cop supports unsafe autocorrection (--autocorrect-all).
199
- Style/StringChars:
200
- Exclude:
201
- - 'lib/cryptum.rb'
202
-
203
- # Offense count: 1
204
- # This cop supports safe autocorrection (--autocorrect).
205
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
206
- # SupportedStyles: single_quotes, double_quotes
207
- Style/StringLiterals:
208
- Exclude:
209
- - 'lib/cryptum/ui/portfolio.rb'
210
-
211
- # Offense count: 2
212
- # This cop supports safe autocorrection (--autocorrect).
213
- # Configuration parameters: .
214
- # SupportedStyles: percent, brackets
215
- Style/SymbolArray:
216
- EnforcedStyle: percent
217
- MinSize: 4
218
-
219
- # Offense count: 1
220
- # This cop supports safe autocorrection (--autocorrect).
221
- # Configuration parameters: EnforcedStyleForMultiline.
222
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
223
- Style/TrailingCommaInArrayLiteral:
224
- Exclude:
225
- - 'lib/cryptum/matrix.rb'
226
-
227
- # Offense count: 26
228
- # This cop supports safe autocorrection (--autocorrect).
229
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
230
- # URISchemes: http, https
231
- Layout/LineLength:
232
- Max: 222
data/bin/cryptum-forecast CHANGED
@@ -5,6 +5,7 @@
5
5
  require 'optparse'
6
6
  require 'cryptum'
7
7
 
8
+ # Parameters available for this driver
8
9
  class Choice
9
10
  attr_accessor :autotrade_percent,
10
11
  :cycles_complete,
@@ -132,7 +133,7 @@ begin
132
133
  crypto: crypto,
133
134
  fiat: fiat,
134
135
  fiat_portfolio_file: fiat_portfolio_file
135
- )
136
+ )
136
137
 
137
138
  fiat_portfolio = JSON.parse(
138
139
  File.read(fiat_portfolio_file),
data/lib/cryptum/api.rb CHANGED
@@ -211,7 +211,7 @@ module Cryptum
211
211
  f.puts "#{e}\n#{e.response}\n\n\n"
212
212
  end
213
213
 
214
- insufficient_funds = '{"message":"Insufficient funds"}'
214
+ insufficient_funds = '{"message":"Insufficient funds"}'
215
215
  size -= base_increment if e.response == insufficient_funds
216
216
 
217
217
  sleep 0.3
@@ -361,7 +361,6 @@ module Cryptum
361
361
  balance.to_f * price.to_f
362
362
  )
363
363
 
364
-
365
364
  order_hash = {}
366
365
 
367
366
  order_hash[:type] = 'limit'
@@ -527,7 +526,7 @@ module Cryptum
527
526
  option_choice: option_choice,
528
527
  env: env
529
528
  )
530
-
529
+
531
530
  portfolio_complete_arr = []
532
531
  portfolio_complete_arr = rest_api_call(
533
532
  option_choice: option_choice,
@@ -601,12 +600,12 @@ module Cryptum
601
600
  # This is a hack to ensure we do.
602
601
  profiles = {}
603
602
  # loop do
604
- profiles = rest_api_call(
605
- option_choice: option_choice,
606
- env: env,
607
- http_method: :GET,
608
- api_call: profiles_api_call
609
- )
603
+ profiles = rest_api_call(
604
+ option_choice: option_choice,
605
+ env: env,
606
+ http_method: :GET,
607
+ api_call: profiles_api_call
608
+ )
610
609
 
611
610
  # break unless fees.empty?
612
611
 
@@ -646,11 +645,11 @@ module Cryptum
646
645
  order[:created_at]
647
646
  ).localtime.to_s
648
647
 
649
- if order[:done_at]
650
- order[:done_at] = Time.parse(
651
- order[:done_at]
652
- ).localtime.to_s
653
- end
648
+ next unless order[:done_at]
649
+
650
+ order[:done_at] = Time.parse(
651
+ order[:done_at]
652
+ ).localtime.to_s
654
653
  end
655
654
 
656
655
  order_history
@@ -155,7 +155,7 @@ module Cryptum
155
155
  '> ',
156
156
  '< ',
157
157
  '. ',
158
- ', ',
158
+ ', '
159
159
  ]
160
160
 
161
161
  last_index = matrix_arr.length - 1
@@ -99,7 +99,7 @@ module Cryptum
99
99
  out_line_no = 0
100
100
  command_win.setpos(
101
101
  out_line_no,
102
- Cryptum::UI.col_center(str: command_str_r2_arr.join(''))
102
+ Cryptum::UI.col_center(str: command_str_r2_arr.join)
103
103
  )
104
104
  command_win.clrtoeol
105
105
 
@@ -194,7 +194,7 @@ module Cryptum
194
194
  out_line_no += 1
195
195
  command_win.setpos(
196
196
  out_line_no,
197
- Cryptum::UI.col_center(str: command_str_r3_arr.join(''))
197
+ Cryptum::UI.col_center(str: command_str_r3_arr.join)
198
198
  )
199
199
  command_win.clrtoeol
200
200
 
@@ -36,7 +36,7 @@ module Cryptum
36
36
  # crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
37
37
  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
38
38
  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
39
- # crypto_smallest_size_to_buy = format(
39
+ # crypto_smallest_size_to_buy = format(
40
40
  # "%0.#{crypto_smallest_decimal}f",
41
41
  # min_market_funds.to_f / ticker_price
42
42
  # )
@@ -119,7 +119,6 @@ module Cryptum
119
119
  fiat_avail_for_trade = format('%0.2f', fiat_portfolio.first[:available])
120
120
 
121
121
  event_history.red_pill = true if fiat_invested_this_order > fiat_avail_for_trade.to_f
122
-
123
122
 
124
123
  unless event_history.red_pill
125
124
  event_history = Cryptum::API.submit_limit_order(
@@ -137,12 +136,12 @@ module Cryptum
137
136
  # Mock Order ID
138
137
  this_order[:buy_order_id] = format(
139
138
  '%0.6i',
140
- Random.rand(0..999999)
139
+ Random.rand(0..999_999)
141
140
  )
142
141
 
143
142
  this_order[:price] = limit_price.to_s
144
143
  this_order[:size] = format(
145
- "%0.#{crypto_smallest_decimal}f",
144
+ "%0.#{crypto_smallest_decimal}f",
146
145
  this_order[:invest].to_f / limit_price
147
146
  )
148
147
 
@@ -181,12 +180,12 @@ module Cryptum
181
180
  # limit sell order for fulfillment
182
181
  unless option_choice.autotrade
183
182
  # Testing logic via Mock
184
- event_type_arr = [:received, :open, :done]
183
+ event_type_arr = %i[received open done]
185
184
  last_et_index = event_type_arr.length - 1
186
185
  rand_et_index = Random.rand(0..last_et_index)
187
186
  event_type = event_type_arr[rand_et_index]
188
187
 
189
- event_side_arr = [:buy, :sell]
188
+ event_side_arr = %i[buy sell]
190
189
  last_es_index = event_side_arr.length - 1
191
190
  rand_es_index = Random.rand(0..last_es_index)
192
191
  event_side = event_type_arr[rand_es_index].to_s.to_sym
@@ -203,7 +202,7 @@ module Cryptum
203
202
  meta[:color] = :red if meta[:buy_order_id] == buy_order_id
204
203
  end
205
204
  end
206
-
205
+
207
206
  if event_type == :done &&
208
207
  event_side == :buy &&
209
208
  event_reason == :canceled
@@ -211,6 +210,7 @@ module Cryptum
211
210
  buy_order_id = event_history.event[:order_id]
212
211
  order_history_meta.each do |meta|
213
212
  next unless meta[:buy_order_id] == buy_order_id
213
+
214
214
  buy_done_at_hash_arr = order_history.select do |oh|
215
215
  oh[:id] == meta[:buy_order_id]
216
216
  end
@@ -260,7 +260,7 @@ module Cryptum
260
260
  else
261
261
  sell_order_id = format(
262
262
  '%0.2i',
263
- Random.rand(0..999999)
263
+ Random.rand(0..999_999)
264
264
  )
265
265
 
266
266
  event_history.order_book[:order_history_meta].each do |meta|
@@ -272,7 +272,7 @@ module Cryptum
272
272
  end
273
273
  end
274
274
  end
275
-
275
+
276
276
  # Update Canceled Sell Orders w/ Black &&
277
277
  # Include done_at Timestamp for 24h gain calc
278
278
  if event_type == :done &&
@@ -282,6 +282,7 @@ module Cryptum
282
282
  sell_order_id = event_history.event[:order_id]
283
283
  order_history_meta.each do |meta|
284
284
  next unless meta[:sell_order_id] == sell_order_id
285
+
285
286
  sell_done_at_hash_arr = order_history.select do |oh|
286
287
  oh[:id] == meta[:sell_order_id]
287
288
  end
@@ -304,6 +305,7 @@ module Cryptum
304
305
  sell_order_id = event_history.event[:order_id]
305
306
  order_history_meta.each do |meta|
306
307
  next unless meta[:sell_order_id] == sell_order_id
308
+
307
309
  sell_done_at_hash_arr = order_history.select do |oh|
308
310
  oh[:id] == meta[:sell_order_id]
309
311
  end
@@ -312,9 +314,9 @@ module Cryptum
312
314
  meta[:color] = :green
313
315
  end
314
316
  end
315
-
317
+
316
318
  # OK, now let's tally up everything...
317
- twenty_four_hrs_ago = Time.now - 86400
319
+ twenty_four_hrs_ago = Time.now - 86_400
318
320
 
319
321
  # Snag all sold orders
320
322
  oh_meta_sold_arr = order_history_meta.select do |ohm|
@@ -357,8 +359,7 @@ module Cryptum
357
359
  )
358
360
 
359
361
  total_to_sell = order_history.select do |oh|
360
- oh[:status].to_sym == :open &&
361
- oh[:side].to_sym == :sell
362
+ oh[:status].to_sym == :open && oh[:side].to_sym == :sell
362
363
  end.length
363
364
  total_to_sell = "#{total_to_sell}+" if total_to_sell == 1000
364
365
 
@@ -399,7 +400,7 @@ module Cryptum
399
400
  )
400
401
 
401
402
  header_str = '- ORDER HISTORY -'
402
- order_execute_win.setpos(
403
+ order_execute_win.setpos(
403
404
  out_line_no,
404
405
  Cryptum::UI.col_center(str: header_str)
405
406
  )
@@ -493,7 +494,7 @@ module Cryptum
493
494
 
494
495
  # Clear to SUMMARY
495
496
  # (Only Applicable if order_book[:order_history_meta] < max_rows_to_display)
496
- out_line_no+=1
497
+ out_line_no += 1
497
498
  rows_to_blank = (out_line_no + remaining_blank_rows) - 1
498
499
  (out_line_no..rows_to_blank).each do |clr_line|
499
500
  out_line_no = clr_line
@@ -64,7 +64,7 @@ module Cryptum
64
64
 
65
65
  order_history = event_history.order_book[:order_history]
66
66
  open_orders = order_history.select do |order|
67
- order[:status] == 'open'
67
+ order[:status] == 'open'
68
68
  end
69
69
  total_open_orders = open_orders.length
70
70
 
@@ -123,7 +123,7 @@ module Cryptum
123
123
  fiat_investing * tpm_cast_as_decimal
124
124
  )
125
125
  profit = fiat_returning - fiat_investing
126
-
126
+
127
127
  break if order_plan.map { |op| op[:invest].to_f }.sum > risk_target ||
128
128
  allocation_percent > 100
129
129
 
@@ -239,7 +239,7 @@ module Cryptum
239
239
  color: header_color,
240
240
  style: header_style,
241
241
  string: ''.ljust(col_just1, ' ')
242
- )
242
+ )
243
243
 
244
244
  header_str = "- ORDER PLAN | CYCLE ##{order_plan_prefix} -"
245
245
  order_plan_win.setpos(
@@ -56,7 +56,7 @@ module Cryptum
56
56
  intent = "- #{speed} BUY: #{order_countdown} of #{time_between_order_exec_out} -"
57
57
  intent = '- BUYING PAUSED -' if event_history.red_pill
58
58
  end
59
-
59
+
60
60
  # Have a Clock
61
61
  clock = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
62
62
 
@@ -136,7 +136,7 @@ module Cryptum
136
136
  Cryptum::UI.colorize(
137
137
  ui_win: portfolio_win,
138
138
  color: :cyan,
139
- string: "TPM % | Autotrade %:"
139
+ string: 'TPM % | Autotrade %:'
140
140
  )
141
141
 
142
142
  portfolio_win.setpos(out_line_no, Cryptum::UI.col_third)
@@ -115,8 +115,7 @@ module Cryptum
115
115
 
116
116
  order_history = order_book[:order_history]
117
117
  open_sell_orders = order_history.select do |order|
118
- order[:status] == 'open' &&
119
- order[:side] == 'sell'
118
+ order[:status] == 'open' && order[:side] == 'sell'
120
119
  end
121
120
 
122
121
  sorted_open_sell_orders = open_sell_orders.sort_by do |order|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.299'
4
+ VERSION = '0.0.300'
5
5
  end
data/lib/cryptum.rb CHANGED
@@ -125,20 +125,18 @@ module Cryptum
125
125
  # Update Key/Value Pair in Bot Conf and Serialize to YAML File
126
126
  public_class_method def self.beautify_large_number(opts = {})
127
127
  value = opts[:value].to_s
128
-
128
+
129
129
  split_str_num = value.split('.')
130
130
  whole_num = split_str_num.first
131
131
  fraction = 0
132
132
  fraction = split_str_num.last if split_str_num.length > 1
133
133
 
134
134
  is_negative = false
135
- is_negative = true if whole_num.split('').first == '-'
135
+ is_negative = true if whole_num.chars.first == '-'
136
136
  whole_num = whole_num[1..] if is_negative
137
137
  beautify_whole = whole_num.reverse.scan(/.{1,3}/).join(',').reverse
138
138
  beautify_num = "#{beautify_whole}.#{fraction}" unless is_negative
139
139
  beautify_num = "-#{beautify_whole}.#{fraction}" if is_negative
140
-
141
- return beautify_num
142
140
  rescue Interrupt
143
141
  # Exit Gracefully if CTRL+C is Pressed During Session
144
142
  Cryptum.exit_gracefully(which_self: self)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.299
4
+ version: 0.0.300
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.