rudelo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/README.md +7 -0
- data/lib/rudelo/matchers/set_logic.rb +9 -1
- data/lib/rudelo/version.rb +1 -1
- data/spec/matchers/set_logic_spec.rb +7 -0
- metadata +29 -28
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# Rudelo
|
2
|
+
[![Build Status](https://travis-ci.org/lastobelus/rudelo.png)](https://travis-ci.org/lastobelus/rudelo)
|
2
3
|
|
3
4
|
Provides Rufus::Decision::Matchers::SetLogic, for use with [rufus-decision][1]
|
4
5
|
|
6
|
+
## Requires ruby 1.9.3
|
7
|
+
Currently not working on 1.9.2 -- will try to get this working at some point. Probably won't get 1.8.7 working.
|
8
|
+
|
9
|
+
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
In Gemfile:
|
@@ -55,6 +61,7 @@ And then execute:
|
|
55
61
|
4. Push to the branch (`git push origin my-new-feature`)
|
56
62
|
5. Create new Pull Request
|
57
63
|
|
64
|
+
|
58
65
|
[1]: https://github.com/jmettraux/rufus-decision
|
59
66
|
[2]: https://github.com/lastobelus/rufus-decision/tree/pluggable_matchers
|
60
67
|
[3]: https://github.com/lastobelus/rufus-decision
|
@@ -29,8 +29,11 @@ module Rudelo
|
|
29
29
|
module Matchers
|
30
30
|
class SetLogic < Rufus::Decision::Matcher
|
31
31
|
|
32
|
+
attr_accessor :force
|
32
33
|
|
33
34
|
def matches?(cell, value)
|
35
|
+
evaluator = ast(cell)
|
36
|
+
return false if evaluator.nil?
|
34
37
|
in_set = value_transform.apply(value_parser.parse(value))
|
35
38
|
ast(cell).eval(in_set)
|
36
39
|
end
|
@@ -60,7 +63,12 @@ module Rudelo
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def ast(cell)
|
63
|
-
asts[cell] ||=
|
66
|
+
asts[cell] ||= begin
|
67
|
+
logic_transform.apply(logic_parser.parse(cell))
|
68
|
+
rescue
|
69
|
+
raise if force
|
70
|
+
nil
|
71
|
+
end
|
64
72
|
end
|
65
73
|
|
66
74
|
end
|
data/lib/rudelo/version.rb
CHANGED
@@ -5,6 +5,13 @@ require 'rufus-decision'
|
|
5
5
|
describe "Rudelo::Matchers::SetLogic" do
|
6
6
|
subject{Rudelo::Matchers::SetLogic.new}
|
7
7
|
|
8
|
+
context "non-set cells never match" do
|
9
|
+
specify{ expect(subject.matches?('5', '5')).to be_false}
|
10
|
+
specify{ expect(subject.matches?(5, 4)).to be_false}
|
11
|
+
specify{ expect(subject.matches?('bob', 'mary')).to be_false}
|
12
|
+
specify{ expect(subject.matches?('bob', 'bob')).to be_false}
|
13
|
+
end
|
14
|
+
|
8
15
|
it "matches multiple values against multiple cells correctly" do
|
9
16
|
cell1 = "$in same-as $(a b c)"
|
10
17
|
cell2 = "$in same-as $(k f r)"
|
metadata
CHANGED
@@ -1,96 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudelo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Johnston
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rufus-decision
|
16
|
-
type: :runtime
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '1.4'
|
22
|
-
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
23
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
27
29
|
version: '1.4'
|
28
|
-
none: false
|
29
|
-
prerelease: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: parslet
|
32
|
-
type: :runtime
|
33
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
|
-
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
39
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
40
42
|
requirements:
|
41
43
|
- - ! '>='
|
42
44
|
- !ruby/object:Gem::Version
|
43
45
|
version: '0'
|
44
|
-
none: false
|
45
|
-
prerelease: false
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: bundler
|
48
|
-
type: :development
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.3'
|
54
|
-
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
55
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
56
58
|
requirements:
|
57
59
|
- - ~>
|
58
60
|
- !ruby/object:Gem::Version
|
59
61
|
version: '1.3'
|
60
|
-
none: false
|
61
|
-
prerelease: false
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rake
|
64
|
-
type: :development
|
65
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
-
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
71
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
72
74
|
requirements:
|
73
75
|
- - ! '>='
|
74
76
|
- !ruby/object:Gem::Version
|
75
77
|
version: '0'
|
76
|
-
none: false
|
77
|
-
prerelease: false
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rspec
|
80
|
-
type: :development
|
81
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
|
-
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
87
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
88
90
|
requirements:
|
89
91
|
- - ! '>='
|
90
92
|
- !ruby/object:Gem::Version
|
91
93
|
version: '0'
|
92
|
-
none: false
|
93
|
-
prerelease: false
|
94
94
|
description: Set Logic Matcher for rufus-decision
|
95
95
|
email:
|
96
96
|
- lastobelus@mac.com
|
@@ -100,6 +100,7 @@ extra_rdoc_files: []
|
|
100
100
|
files:
|
101
101
|
- .gitignore
|
102
102
|
- .rspec
|
103
|
+
- .travis.yml
|
103
104
|
- Gemfile
|
104
105
|
- Guardfile
|
105
106
|
- LICENSE.txt
|
@@ -128,23 +129,23 @@ rdoc_options: []
|
|
128
129
|
require_paths:
|
129
130
|
- lib
|
130
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
131
133
|
requirements:
|
132
134
|
- - ! '>='
|
133
135
|
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
134
137
|
segments:
|
135
138
|
- 0
|
136
|
-
hash: -
|
137
|
-
version: '0'
|
138
|
-
none: false
|
139
|
+
hash: -129801589955190531
|
139
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
140
142
|
requirements:
|
141
143
|
- - ! '>='
|
142
144
|
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
143
146
|
segments:
|
144
147
|
- 0
|
145
|
-
hash: -
|
146
|
-
version: '0'
|
147
|
-
none: false
|
148
|
+
hash: -129801589955190531
|
148
149
|
requirements: []
|
149
150
|
rubyforge_project:
|
150
151
|
rubygems_version: 1.8.25
|