eqn 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +3 -1
- data/eqn.gemspec +1 -1
- data/lib/eqn/calculator.rb +3 -1
- data/lib/eqn/parser.rb +1 -1
- data/lib/eqn/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e11ea96f9a2aaa28a8cc84f85f2d9cddc3dbdf9
|
4
|
+
data.tar.gz: 343629ec590a51c1d1cc681e765847fd678f1a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc50130a2876c2071250e64d517c0941b00ed450dc5e133182354e752729c037db43a46c8739baeb05c0c32cc86a51d3f5058b3642fb3ad637b78cf032a4b69
|
7
|
+
data.tar.gz: 7b26401ea648a23376c8ab5cd27faf39bea1a3cf2cfba87763c5576bc66488631a5b972e08baa70d72993a03c17d457dfbc75868b41aa57c1954f30084446239
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/schneidmaster/eqn.svg?branch=master)](https://travis-ci.org/schneidmaster/eqn)
|
2
|
+
|
1
3
|
# Eqn
|
2
4
|
|
3
5
|
Eqn uses the Treetop parser generator to safely evaluate mathematical expressions in Ruby.
|
@@ -29,7 +31,7 @@ You can also check if an equation is valid:
|
|
29
31
|
|
30
32
|
$ Eqn::Calculator.valid?('1 + 1')
|
31
33
|
# => true
|
32
|
-
$ Eqn::Calculator.valid?('1 +
|
34
|
+
$ Eqn::Calculator.valid?('1 + / 1')
|
33
35
|
# => false
|
34
36
|
|
35
37
|
If you want to peek at how Eqn is parsing an equation, run the following to get the syntax tree:
|
data/eqn.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.8'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rubocop', '~> 0.31'
|
27
|
-
spec.add_development_dependency '
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.2.0'
|
28
28
|
end
|
data/lib/eqn/calculator.rb
CHANGED
data/lib/eqn/parser.rb
CHANGED
@@ -15,7 +15,7 @@ module Eqn
|
|
15
15
|
def self.parse(data)
|
16
16
|
# Remove any whitespace and pass the data over to the parser instance.
|
17
17
|
data.downcase!
|
18
|
-
while data =~ Eqn::WHITESPACE_REGEX
|
18
|
+
while data =~ Eqn::WHITESPACE_REGEX
|
19
19
|
data = data.downcase.gsub(Eqn::WHITESPACE_REGEX) do
|
20
20
|
Regexp.last_match.to_s.delete(' ')
|
21
21
|
end
|
data/lib/eqn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eqn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: treetop
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.31'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.2.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.2.0
|
83
83
|
description: A gem to evaluate numerical equations. Includes support for functions.
|
84
84
|
email:
|
85
85
|
- zach@aha.io
|