eqn 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/eqn.gemspec +1 -1
- data/lib/eqn/calculator.rb +1 -1
- data/lib/eqn/errors.rb +5 -4
- data/lib/eqn/function.rb +1 -5
- data/lib/eqn/number.rb +1 -5
- data/lib/eqn/terminal.rb +2 -0
- data/lib/eqn/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcea04f191cf70d2f6248b5d46ed239e67993062
|
4
|
+
data.tar.gz: 0cde20afa46cfcabd29a11240eeb47b082a93cb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0d4e68fae317102d84ebfd8bbd920dbb60e04826764a7f9a7ca5c813d169f1a734a4e26f62878923c58932a521268ddcef52f176de060cb535ebf9442aaf6c9
|
7
|
+
data.tar.gz: 3535a6c2ebaa09fb57f1c082e2e691b57d582755939df737853ba5d6dc90182b6b94d0345f59d246a314dbd0dec8be1f103d5129c8e0255305f6c08ef67403d5
|
data/.rubocop.yml
CHANGED
data/eqn.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['zach@aha.io']
|
11
11
|
|
12
12
|
spec.summary = 'A gem to evaluate numerical equations.'
|
13
|
-
spec.description = 'A gem to evaluate numerical equations. Includes support for functions.'
|
13
|
+
spec.description = 'A gem to evaluate numerical equations. Includes support for variables and functions.'
|
14
14
|
spec.homepage = 'https://github.com/schneidmaster/eqn'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
data/lib/eqn/calculator.rb
CHANGED
data/lib/eqn/errors.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Eqn
|
2
|
-
class
|
3
|
-
class
|
4
|
-
class
|
5
|
-
class
|
2
|
+
class EqnError < StandardError; end
|
3
|
+
class NonNumericVariableError < EqnError; end
|
4
|
+
class NoVariableValueError < EqnError; end
|
5
|
+
class ParseError < EqnError; end
|
6
|
+
class ZeroDivisionError < EqnError; end
|
6
7
|
end
|
data/lib/eqn/function.rb
CHANGED
data/lib/eqn/number.rb
CHANGED
data/lib/eqn/terminal.rb
CHANGED
@@ -3,6 +3,7 @@ module Eqn
|
|
3
3
|
class Node < Treetop::Runtime::SyntaxNode; end
|
4
4
|
|
5
5
|
class Variable < Node
|
6
|
+
# rubocop:disable Metrics/AbcSize
|
6
7
|
def value
|
7
8
|
unless Eqn::Calculator.class_variable_get(:@@vars).key? text_value.intern
|
8
9
|
fail NoVariableValueError, "No value given for: #{text_value}"
|
@@ -12,6 +13,7 @@ module Eqn
|
|
12
13
|
end
|
13
14
|
Eqn::Calculator.class_variable_get(:@@vars)[text_value.intern]
|
14
15
|
end
|
16
|
+
# rubocop:enable Metrics/AbcSize
|
15
17
|
end
|
16
18
|
|
17
19
|
class Digits < Node
|
data/lib/eqn/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eqn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Schneider
|
@@ -108,7 +108,8 @@ dependencies:
|
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.10.0
|
111
|
-
description: A gem to evaluate numerical equations. Includes support for
|
111
|
+
description: A gem to evaluate numerical equations. Includes support for variables
|
112
|
+
and functions.
|
112
113
|
email:
|
113
114
|
- zach@aha.io
|
114
115
|
executables: []
|