cryptocoin_fanboi 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/cryptocoin_fanboi.rb +13 -12
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27cae82a02da0d5ebc25cfcb1c4dccc11b2c7ab7
|
4
|
+
data.tar.gz: 8b10cee37c9d501214baaaabae8e78e3db8b7c0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad884e74f813dc4d71fb08029e3a43ed895f3e2f189e267eaa9586dfd9004fb50d14bc9b0eeeaf706154eb3aa60299c4a39b523d464845b43ed3c7ae316f20b0
|
7
|
+
data.tar.gz: f650d06018bad4e16eb7a0b165fdb0d2ecfe205d75ecc496b16903dd137464822180f4013f3aafa1325835771f5512a2d1f5fb66604011369ab9d676751bda7e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/cryptocoin_fanboi.rb
CHANGED
@@ -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
|
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 =
|
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
|
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
|
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
|
494
|
+
def sort_coins(period='7d', limit: 5, rank: :top)
|
495
495
|
|
496
|
-
a = @coins.sort_by {|x| -x['percent_change_' + period].to_f}
|
497
|
-
a.
|
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
metadata.gz.sig
CHANGED
Binary file
|