tape_measure 0.0.3 → 0.0.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: 9d3d270bad471ee276eefe3ed9d5d44dc088dc9e
4
- data.tar.gz: 5cc0a3872d82df9c8c5717f68218ddc98fdb015b
3
+ metadata.gz: 07320203954dff2f3a7bb0752bb30ef17ca04edd
4
+ data.tar.gz: 3c82a17ce14afc4742e7888c848def08b9f6308b
5
5
  SHA512:
6
- metadata.gz: 5b8ea470d02682103968a33a75092aab23779eafa056049fa95da997a98e41ddda3d5e0eabc04f525e269df6a315d3ff3e437581c3c8f43ac79ae85ffe3b5dde
7
- data.tar.gz: 04e3188f2eaaae4a2653c58eb191bd42bd898111c081a5d77361b485afbbeaf756bc55ff393ba1bb08991be46ef76e9a9b00614defc93d7502fce52bc6693a29
6
+ metadata.gz: 981b263f657144e96b6bd263332e61faf7d06e6ed059ae54b12ab55b494474f8feefc90245f4c451917622138c48164e9a8d01539f37a8d56d63fcc27eb3938d
7
+ data.tar.gz: ebaff9f5840153a4ae9d15b597064326b6db4dc39f3aaf68797273753a84afe500e4186105b08ab1613890886bcbe7d2295add41cb9619a54a80ff755822363b
@@ -9,8 +9,13 @@ module TapeMeasure
9
9
 
10
10
  def initialize(string)
11
11
  @string = string
12
- return @string.blank? if @string == 0.0
13
- parse
12
+ if @string.is_a?(String)
13
+ parse
14
+ else
15
+ @value = string
16
+ end
17
+
18
+
14
19
  end
15
20
 
16
21
  def parse
@@ -1,3 +1,3 @@
1
1
  module TapeMeasure
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -21,6 +21,19 @@ describe TapeMeasure do
21
21
  # 1' 2' 3' 127cm
22
22
  # 5 (assumes inches)
23
23
  # 3-3/4" = 2.75
24
+
25
+ it 'can handle integer' do
26
+ TapeMeasure.parse(6).should eq 6
27
+ end
28
+
29
+ it 'can handle nil' do
30
+ TapeMeasure.parse(nil).should eq nil
31
+ end
32
+
33
+ it 'can handle empty string' do
34
+ TapeMeasure.parse("").should eq nil
35
+ end
36
+
24
37
  describe :grammar do
25
38
  it 'can add' do
26
39
  TapeMeasure::Parser.new('(8+2)').value.should eq 10
@@ -28,7 +41,6 @@ describe TapeMeasure do
28
41
  TapeMeasure::Parser.new('(8 + 2)').value.should eq 10
29
42
  TapeMeasure::Parser.new('8 + 2').value.should eq 10
30
43
  end
31
-
32
44
  it 'can subtract' do
33
45
  TapeMeasure::Parser.new('4 - 2').value.should eq 2
34
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tape_measure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Congleton