arithmetic 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmM2NTUzYjc0MGY1NTZiNDIxYTJkYTYxOThhNjU1YmU2OWIxZmE1ZA==
5
- data.tar.gz: !binary |-
6
- NzU1ZWJlOTViNzIxZGY2MzA1YjczNTdjM2NmMWRkYTY5ZTQ3OGM3ZQ==
2
+ SHA256:
3
+ metadata.gz: b8c6ca40238fa6f91a63c2e1ca8e4dad24d32173cf0aa155f00da34aefe9e48e
4
+ data.tar.gz: b7f1e55c16263fe2085f43e8d9444ce1b98b9465587b3e81e97922ea32cc1991
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjgyODFmNmE1OWVhNGY2OGU4YTQ5NzNmMDJkYjk0YjAyNGNjZjE2ODZhMzNl
10
- OTMzMGEyZDI2MDkzMjE2MDJiMmIzOGQwYTAxYzQwYTgwNzAyMDRkZDdmNGIx
11
- ZTM5ZGE0OGVjZGVkYTk1MGI0YmE1NTcxNzU4NmQ4Y2RlNmJmNGY=
12
- data.tar.gz: !binary |-
13
- ODYyODFiZTFkOGRkMGZiNGUwZDhkYzE4MDVkMzMyMjczM2IwYzM4NTJjZjgx
14
- ODIxNDJkNjBkYzYzYTAxNDlkZDA2NzIxZDgwZGUxMTc5MWJjMjAzZDY3ZWRl
15
- YzU5Y2M5NjRkNDJkZWNlM2FmODg5NGQwOWE4OTg3MTRhYWIxMGI=
6
+ metadata.gz: a4f60179977cb1d3ec75d432cf50bbfdcba0f1a4d15a633de9dcfcd10ea51f321fe5448c3b01b8573fc342b2938304c1481842ec6499416afa4eccbe0389a369
7
+ data.tar.gz: 96eab3b67e6e403357bfdf0b8cd014d7ef7ae76a6a1ef9768d8be7813cf32d283bce4aee6c4d9d189fcbf903e9e8f2de06230363f0f77c011f1da7cb0eae0187
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arithmetic (0.1.3)
4
+ arithmetic (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -24,3 +24,6 @@ DEPENDENCIES
24
24
  arithmetic!
25
25
  rake
26
26
  rspec
27
+
28
+ BUNDLED WITH
29
+ 2.0.1
@@ -11,7 +11,17 @@ module Arithmetic
11
11
  end
12
12
 
13
13
  def eval
14
- BigDecimal.new(@operand)
14
+ if has_dangling_decimal_point?
15
+ BigDecimal.new(@operand + "0")
16
+ else
17
+ BigDecimal.new(@operand)
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def has_dangling_decimal_point?
24
+ @operand.is_a?(String) && @operand.end_with?(".")
15
25
  end
16
26
  end
17
27
 
@@ -1,3 +1,3 @@
1
1
  module Arithmetic
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -69,6 +69,10 @@ describe Arithmetic do
69
69
  test_eval(2).should == 2
70
70
  end
71
71
 
72
+ it "handles dangling decimal points" do
73
+ test_eval("0.").should == 0
74
+ end
75
+
72
76
  context "invalid expressions" do
73
77
  it "handles blank expressions" do
74
78
  exp_should_error nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arithmetic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Kirby
@@ -9,34 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-18 00:00:00.000000000 Z
12
+ date: 2019-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  description: Simple arithmetic calculator for Ruby
@@ -47,7 +47,7 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
- - .gitignore
50
+ - ".gitignore"
51
51
  - Gemfile
52
52
  - Gemfile.lock
53
53
  - LICENSE.txt
@@ -71,17 +71,17 @@ require_paths:
71
71
  - lib
72
72
  required_ruby_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ! '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ! '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.4.3
84
+ rubygems_version: 2.7.6.2
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Simple arithmetic calculator for Ruby