arithmetic 0.1.2 → 0.1.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzVjMzE4ZDlmZGEzNGY5MDQ4Y2M4NGNmODk3NWI3OWQ5NDk5MGY1MA==
4
+ MmM2NTUzYjc0MGY1NTZiNDIxYTJkYTYxOThhNjU1YmU2OWIxZmE1ZA==
5
5
  data.tar.gz: !binary |-
6
- OGYxMjYyNGZmOTc4ZThhN2U0ZmZkMDk3ODAwNzY5N2QwNWZjMWVmYQ==
6
+ NzU1ZWJlOTViNzIxZGY2MzA1YjczNTdjM2NmMWRkYTY5ZTQ3OGM3ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDhjNGZiZjlmZDY4MTA5MWQyYTRmMWZmOTdlZGQzNmRkOTM0ZWUwNmFlNzBl
10
- NmUxYjAzYTc4Y2ZiYzlhMzdiMTZhMDFlMDRiNTY5NmJiYTVmNjM4MjlhMmY3
11
- ODY4ZjJkMDhhNmFkMzkwNDkwY2QzMmM5ODZiYWU3ZDFmMWUwMjM=
9
+ NjgyODFmNmE1OWVhNGY2OGU4YTQ5NzNmMDJkYjk0YjAyNGNjZjE2ODZhMzNl
10
+ OTMzMGEyZDI2MDkzMjE2MDJiMmIzOGQwYTAxYzQwYTgwNzAyMDRkZDdmNGIx
11
+ ZTM5ZGE0OGVjZGVkYTk1MGI0YmE1NTcxNzU4NmQ4Y2RlNmJmNGY=
12
12
  data.tar.gz: !binary |-
13
- OGIzOGJiNDM2ZmQ4YTVhMDVjMWE1ZjMxNGI0MjY1MjI1MTgyYTI0NjJmZGY0
14
- MWU1ODIyOWI5MmVkOTcwYTQxNTBmZDQxZWExZjcxMjNkNjAzNzc4NDQzMDJh
15
- ZTQyZjA0OTViYjZiZTllZTNmZGU3OGE1NjZkNjkxYjQwZWY4ZTU=
13
+ ODYyODFiZTFkOGRkMGZiNGUwZDhkYzE4MDVkMzMyMjczM2IwYzM4NTJjZjgx
14
+ ODIxNDJkNjBkYzYzYTAxNDlkZDA2NzIxZDgwZGUxMTc5MWJjMjAzZDY3ZWRl
15
+ YzU5Y2M5NjRkNDJkZWNlM2FmODg5NGQwOWE4OTg3MTRhYWIxMGI=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arithmetic (0.1.2)
4
+ arithmetic (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -7,6 +7,9 @@ require 'arithmetic/operators'
7
7
  module Arithmetic
8
8
  # make lazy?
9
9
  def self.parse(expression)
10
+ expression = expression.to_s.strip
11
+ raise Arithmetic::InvalidExpression if expression.empty?
12
+
10
13
  Expression.new(Parser.new(expression).parse)
11
14
  end
12
15
 
@@ -6,7 +6,7 @@ module Arithmetic
6
6
  end
7
7
 
8
8
  def initialize(exp)
9
- @expression = exp.to_s
9
+ @expression = exp
10
10
  @node_stack = []
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Arithmetic
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -70,6 +70,12 @@ describe Arithmetic do
70
70
  end
71
71
 
72
72
  context "invalid expressions" do
73
+ it "handles blank expressions" do
74
+ exp_should_error nil
75
+ exp_should_error ""
76
+ exp_should_error " "
77
+ end
78
+
73
79
  it "handles missing operand" do
74
80
  exp_should_error "1 *"
75
81
  exp_should_error "1 * + 1"
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Kirby
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-17 00:00:00.000000000 Z
12
+ date: 2015-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec