rudelo 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +12 -2
- data/lib/rudelo/matchers/set_logic.rb +5 -1
- data/lib/rudelo/version.rb +1 -1
- metadata +3 -3
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
Provides Rufus::Decision::Matchers::SetLogic, for use with [rufus-decision][1]
|
5
5
|
|
6
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.
|
7
|
+
Currently not working on 1.9.2 -- I will try to get this working at some point. I Probably won't get 1.8.7 working.
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -51,7 +51,16 @@ And then execute:
|
|
51
51
|
table.transform({'group' => "bob alice jeff mary don bev"})
|
52
52
|
#=> {'group' => "bob alice jeff mary don bev", 'situation' => "PARTY!"}
|
53
53
|
|
54
|
+
## Documentation
|
54
55
|
|
56
|
+
For a detailed description of the mini-language the set logic matcher uses, see [SET_LOGIC_MATCHER.md][4]
|
57
|
+
|
58
|
+
## Short-Circuiting
|
59
|
+
|
60
|
+
The current released version of rufus-decision does not provide for matchers to shortcircuit. This can cause errors if you have a SetLogic matcher followed by a String matcher. I have a branch of rufus-decision that does short-circuiting that is pending review, if you need to use it add this to your Gemfile:
|
61
|
+
|
62
|
+
```gem 'rufus-decision', git: 'https://github.com/lastobelus/rufus-decision.git', branch: 'short_circuit_matchers'
|
63
|
+
```
|
55
64
|
|
56
65
|
## Contributing
|
57
66
|
|
@@ -64,4 +73,5 @@ And then execute:
|
|
64
73
|
|
65
74
|
[1]: https://github.com/jmettraux/rufus-decision
|
66
75
|
[2]: https://github.com/lastobelus/rufus-decision/tree/pluggable_matchers
|
67
|
-
[3]: https://github.com/lastobelus/rufus-decision
|
76
|
+
[3]: https://github.com/lastobelus/rufus-decision
|
77
|
+
[4]: https://github.com/lastobelus/rudelo/tree/SET_LOGIC_MATCHER.md
|
@@ -28,9 +28,13 @@ require 'rudelo/parsers/set_logic_transform'
|
|
28
28
|
module Rudelo
|
29
29
|
module Matchers
|
30
30
|
class SetLogic < Rufus::Decision::Matcher
|
31
|
-
|
31
|
+
SYNTAX_EXPR = %r{\$\([^)]\)|\$in}
|
32
32
|
attr_accessor :force
|
33
33
|
|
34
|
+
def should_match?(cell, value)
|
35
|
+
! (cell =~ SYNTAX_EXPR).nil?
|
36
|
+
end
|
37
|
+
|
34
38
|
def matches?(cell, value)
|
35
39
|
evaluator = ast(cell)
|
36
40
|
return false if evaluator.nil?
|
data/lib/rudelo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudelo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
segments:
|
138
138
|
- 0
|
139
|
-
hash:
|
139
|
+
hash: 1721411996862607044
|
140
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
141
|
none: false
|
142
142
|
requirements:
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
segments:
|
147
147
|
- 0
|
148
|
-
hash:
|
148
|
+
hash: 1721411996862607044
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
151
|
rubygems_version: 1.8.25
|