cryptocoin_fanboi 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a966d81c3eb8aaf39c4f0de065c929ffa8d9592b
4
- data.tar.gz: b9c59ed6170b4e2db5fe1652cffb20fdf21a510e
3
+ metadata.gz: 27cae82a02da0d5ebc25cfcb1c4dccc11b2c7ab7
4
+ data.tar.gz: 8b10cee37c9d501214baaaabae8e78e3db8b7c0b
5
5
  SHA512:
6
- metadata.gz: f3aff42b2280366a11d17bbd82a010e4ccbd933e949f9b1a0d0c4fd8342f3a938f20f0d848ef2b87daf2555ee0f2c885ed388c7873ccc325284cd55ece98a3fe
7
- data.tar.gz: 2d3a669447985e4e9b009917d68df836c31380837fb63e38515e23a3cef7763daa6f2927160bd0fe8c5cc6aa2ffde1dc4dd51d90b7478af4095d81a8c43bad3f
6
+ metadata.gz: ad884e74f813dc4d71fb08029e3a43ed895f3e2f189e267eaa9586dfd9004fb50d14bc9b0eeeaf706154eb3aa60299c4a39b523d464845b43ed3c7ae316f20b0
7
+ data.tar.gz: f650d06018bad4e16eb7a0b165fdb0d2ecfe205d75ecc496b16903dd137464822180f4013f3aafa1325835771f5512a2d1f5fb66604011369ab9d676751bda7e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -207,9 +207,9 @@ class CryptocoinFanboi
207
207
 
208
208
  # View the coins with the largest gains in the past hour
209
209
  #
210
- def now(limit: 5, markdown: false)
210
+ def now(limit: 5, markdown: false, rank: :top)
211
211
 
212
- build_table top_coins('1h', limit: limit), markdown: markdown
212
+ build_table sort_coins('1h', limit: limit, rank: rank), markdown: markdown
213
213
 
214
214
  end
215
215
 
@@ -292,9 +292,9 @@ class CryptocoinFanboi
292
292
 
293
293
  # View the coins with the largest gains this week (past 7 days)
294
294
  #
295
- def this_week(limit: 5, markdown: false)
295
+ def this_week(limit: 5, markdown: false, rank: :top)
296
296
 
297
- coins = top_coins(limit: limit)
297
+ coins = sort_coins(limit: limit, rank: rank)
298
298
  build_table coins, markdown: markdown
299
299
 
300
300
  end
@@ -304,9 +304,9 @@ class CryptocoinFanboi
304
304
  # View the coins with the largest gains this
305
305
  # year (since the start of the year)
306
306
  #
307
- def this_year(limit: 5, markdown: false)
307
+ def this_year(limit: 5, markdown: false, rank: :top)
308
308
 
309
- build_table top_coins('year', limit: limit), markdown: markdown
309
+ build_table sort_coins('year', limit: limit, rank: rank), markdown: markdown
310
310
 
311
311
  end
312
312
 
@@ -314,9 +314,9 @@ class CryptocoinFanboi
314
314
 
315
315
  # View the coins with the largest gains today (past 24 hours)
316
316
  #
317
- def today(limit: 5, markdown: false)
317
+ def today(limit: 5, markdown: false, rank: :top)
318
318
 
319
- build_table top_coins('24h', limit: limit), markdown: markdown
319
+ build_table sort_coins('24h', limit: limit, rank: rank), markdown: markdown
320
320
 
321
321
  end
322
322
 
@@ -337,7 +337,7 @@ class CryptocoinFanboi
337
337
 
338
338
  end
339
339
 
340
- def to_s(limit: 5, markdown: false)
340
+ def to_s(limit: 5, markdown: false, rank: :top)
341
341
 
342
342
  coins = (fetch_coinlist(limit: limit))
343
343
 
@@ -491,10 +491,11 @@ class CryptocoinFanboi
491
491
 
492
492
  end
493
493
 
494
- def top_coins(period='7d', limit: 5)
494
+ def sort_coins(period='7d', limit: 5, rank: :top)
495
495
 
496
- a = @coins.sort_by {|x| -x['percent_change_' + period].to_f}.take(limit)
497
- a.map {|coin| @fields.map {|key| coin[key] }}
496
+ a = @coins.sort_by {|x| -x['percent_change_' + period].to_f}
497
+ a.reverse! if rank == :bottom
498
+ a.take(limit).map {|coin| @fields.map {|key| coin[key] }}
498
499
 
499
500
  end
500
501
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptocoin_fanboi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file