simple_logic 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/simple_logic/errors.rb +3 -2
- data/lib/simple_logic/syntax_nodes.rb +1 -1
- data/lib/simple_logic/version.rb +1 -1
- data/spec/simple_logic_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9543681b9629b68fd281afcb83d423e6e598e57
|
4
|
+
data.tar.gz: 77d0fece03df9ce903d0e7fd9198fb481200707a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 681c6ef9151f362279edecb00ad78cf409adf2057d91302ee416cc673e0216ca8374209b225dcc53dd28afe5f057e31d7681fc5fd0abfb72e67a3954104574b3
|
7
|
+
data.tar.gz: df951bd3063c702d309895be9819cfc1ba0044c4b5f480a2ede78ce38fe18a07bf2da8ba1da3dcd33cf171a3a5a5c6c95fdd26349ade3a3399e093928daa4f4c
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# SimpleLogic
|
2
2
|
|
3
|
-
A ruby gem that parses and evaluates simple boolean statements specified as a string. Useful for evaluating user supplied
|
3
|
+
A ruby gem that parses and evaluates simple boolean statements specified as a string. Useful for evaluating user supplied business rules in your application without using ruby's eval().
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/ps2/simple_logic.svg?branch=master)][travis]
|
6
|
+
|
7
|
+
|
8
|
+
[travis]: http://travis-ci.org/ps2/simple_logic
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
data/lib/simple_logic/errors.rb
CHANGED
@@ -63,7 +63,7 @@ module SimpleLogic
|
|
63
63
|
if context.include?(key)
|
64
64
|
context[key]
|
65
65
|
else
|
66
|
-
raise UndefinedVariableError, "Undefined variable: \"#{text_value}\""
|
66
|
+
raise UndefinedVariableError.new(interval.first, text_value), "Undefined variable: \"#{text_value}\""
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/lib/simple_logic/version.rb
CHANGED
data/spec/simple_logic_spec.rb
CHANGED
@@ -53,7 +53,11 @@ describe SimpleLogic do
|
|
53
53
|
it "should raise an exception on undefined variable" do
|
54
54
|
expect {
|
55
55
|
SimpleLogic.eval("testing && hungry", {testing: true})
|
56
|
-
}.to raise_error(SimpleLogic::UndefinedVariableError)
|
56
|
+
}.to raise_error(SimpleLogic::UndefinedVariableError) {|e|
|
57
|
+
expect(e.offset).to eq 11
|
58
|
+
expect(e.name).to eq "hungry"
|
59
|
+
}
|
60
|
+
|
57
61
|
end
|
58
62
|
|
59
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Schwamb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|