valuta 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 5d6e02da5a1e808187168f79d71ed33b1e114b4d
4
- data.tar.gz: d2f5d88c4de41bab14aaf41bdd75341377cc6ba7
3
+ metadata.gz: cce9786111f68a473c396a7f295eb1e19644c8a9
4
+ data.tar.gz: 9d6ecab478ceb6246d277da815d5bc069534bf68
5
5
  SHA512:
6
- metadata.gz: 4c4940e1ee3262fa4306b91f8ad73fdca6ddfd2518f0139624de9ed734154571cf7e6586ef5929a705657edb6edea07cfa02f3265ae3f54219e942801220e2a6
7
- data.tar.gz: 9dc3619b09b2b3b71e312b207dc9842c38fa64f1ae5411e051b96fc9c219a2dcecc2a04ed513a46b3edb72a776e5f2d41e548f49d1c517082d0fc11a13c00cd1
6
+ metadata.gz: 5c89d23a3a491c8c49aeb944576ae5be963730b88efa181f8d9a45ea7c3943f1d5c7222acc00ac3a2f83c89219902b62e599d5d36564a25a2f18c68b63d4dfd3
7
+ data.tar.gz: c2ee3a99206716c9aab1a80091614b766e1fe74cb0675494551abec9d4743a828467fcaaabba5de075ce05c50439dd17c434963570c42529e9667d2b915f5472
data/README.md CHANGED
@@ -11,8 +11,8 @@ require "valuta"
11
11
  Valuta.convert(1458) # => 1,458
12
12
  Valuta.convert(1458.65) # => 1,458.65
13
13
  Valuta.convert("1458.65") # => 1,458.65
14
- Valuta.convert(1458, prefix: "$") # => $1458
15
- Valuta.convert(1458, suffix: " NOK") # => 1458 NOK
14
+ Valuta.convert(1458, prefix: "$") # => $1,458
15
+ Valuta.convert(1458, suffix: " NOK") # => 1,458 NOK
16
16
 
17
17
  Valuta.convert(100458.65, delimiter: ".", separator: ",")
18
18
  # => 100.458,65
data/lib/valuta.rb CHANGED
@@ -20,6 +20,8 @@ class Valuta
20
20
  end
21
21
 
22
22
  def convert(number)
23
+ return "" if number.to_s.empty?
24
+
23
25
  prefix = @options[:prefix]
24
26
  suffix = @options[:suffix]
25
27
 
@@ -1,3 +1,3 @@
1
1
  class Valuta
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/test/valuta_test.rb CHANGED
@@ -40,4 +40,9 @@ scope do
40
40
 
41
41
  assert_equal("-1,563.654", Valuta.convert(number))
42
42
  end
43
+
44
+ test "empty" do
45
+ assert_equal("", Valuta.convert(nil))
46
+ assert_equal("", Valuta.convert(""))
47
+ end
43
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valuta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mayn Ektvedt Kjær