cryptocoin_fanboi 0.4.3 → 0.5.0

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: 94c838cdf13664783e64bec8c76ed8abc8225045
4
- data.tar.gz: 55a28c21a5b1ed2aba3332275b0b985a4ea5516b
3
+ metadata.gz: 07c9a2156681bbbee487cca2e1fffecde1640c56
4
+ data.tar.gz: cc3a923a667276916cde2ea98abf5dce29879bca
5
5
  SHA512:
6
- metadata.gz: 51e9a7dd69db19795abd339f3a6660f7c8baf70b5baf8bcea1b20b8e1665c35bacf80fb4e1fdb3254262426de441596a691d5483a19521b5a6d4f3c1e8eb8920
7
- data.tar.gz: 696ab312d56b6cafa8d8fbf7754f428b29dd1c2691dc48f442fceda6a90bd0d17f0f124080db5dff1196dd5f5cf03f3766ebca7300ee749fa232aa177e714d5c
6
+ metadata.gz: '001428295c50188accd277f9dfa23101d1a845e2f3477c05832ef2c88614d3782cf90d9b1305b62982960017c49a2c05b233ba8aed98342856d97c848b4c92b3'
7
+ data.tar.gz: f0992ced6130d46d0764bceec720aed292d4b6144c1f2b315016e21a1daaa3c2d5e28270e50a05cb6f11784420c632d4924e88dd2cc34f0b29fa81afc45001e2
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -41,7 +41,24 @@ require 'justexchangerates'
41
41
 
42
42
  =end
43
43
 
44
+ module Colour
45
+
46
+ def colourise(x)
47
+
48
+ return x if x.to_s.strip.empty?
49
+
50
+ s3 = (x.to_s.sub(/[\d\.\-]+/) {|s2| "%.2f" % s2})
51
+ s = s3[(s3.length - x.to_s.length)..-1]
52
+
53
+ s[/^ *-/] ? s.red : s.green
54
+ end
55
+
56
+ alias c colourise
57
+
58
+ end
59
+
44
60
  class CryptocoinFanboi
61
+ include Colour
45
62
 
46
63
  attr_reader :coins, :all_coins
47
64
  attr_accessor :colored
@@ -278,6 +295,7 @@ class CryptocoinFanboi
278
295
  format_table(a, markdown: markdown, labels: @labels[0..-2])
279
296
 
280
297
  end
298
+
281
299
 
282
300
  def format_table(source, markdown: markdown, labels: @labels)
283
301
 
@@ -297,7 +315,7 @@ class CryptocoinFanboi
297
315
 
298
316
  fields = line.split('|')
299
317
 
300
- a2 = fields[5..-2].map {|x| x[/^ +-/] ? x.red : x.green }
318
+ a2 = fields[5..-2].map {|x| c(x) }
301
319
  (fields[0..4] + a2 + ["\n"]).join('|')
302
320
 
303
321
  end
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.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  NgmsFfw10oaD3PWQ7UPxWJP14au2LUL+NGHkLrGHOMPphsZhYeXKugGO8NfcKukq
31
31
  fps=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-03-09 00:00:00.000000000 Z
33
+ date: 2018-03-10 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: colored
metadata.gz.sig CHANGED
Binary file