sandthorn_event_filter 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49c7333b460d91409411e0513f2af60e62a9f2da
4
- data.tar.gz: 4b8c59519bf1a4f8f6d98ff77626a3e5a9cccd00
3
+ metadata.gz: 45a6c8aba8c3bc440461b16ef9c003a602ad0dbb
4
+ data.tar.gz: 1cd62fdce2613f422cad8d617147e708109ee5d4
5
5
  SHA512:
6
- metadata.gz: 62a0d64ef0a763a31655a7953c241c765166deb5a85ce98125e9b1e734c97e5e44ea84bd0a8d54b8365cb92bcd2f44b10ad623c1c86609dbe1664cfdbe590579
7
- data.tar.gz: 0620d2f171ed87ee1c96a758a306b858262c3a9c69e2522a86fcb8bb8fbe53e935d78e5b93fe3f6e8c88ab2be3896bdd3c2e3cae92c86a378d25bee703b99e1a
6
+ metadata.gz: 3e3f32c125b34f2e487fe93d6d5d116ac6dba45eec4e0d46e74d851d7aa033d97f46f5e93a30fdb9f833a2c8f433de4151e589cb88b649d3223e8e40f23ee8f3
7
+ data.tar.gz: 4cd20cb83558a3eca0d080ab0c1d4f54e8a8699f3e5c797a7b1ca90f85985531a580829a80f826f50acfe423e1b381e278b2899f1be03c0a751900e042d0b85e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sandthorn_event_filter (0.0.3)
4
+ sandthorn_event_filter (0.0.4)
5
5
  hamster
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -12,7 +12,7 @@ They are composable in the following senses:
12
12
 
13
13
  Add this line to your application's Gemfile:
14
14
 
15
- gem 'event_filter'
15
+ gem 'sandthorn_event_filter'
16
16
 
17
17
  And then execute:
18
18
 
@@ -20,17 +20,19 @@ And then execute:
20
20
 
21
21
  Or install it yourself as:
22
22
 
23
- $ gem install event_filter
23
+ $ gem install sandthorn_event_filter
24
24
 
25
25
  ## Usage
26
26
 
27
27
  The basic way to use a Filter is to wrap an array of Events:
28
28
 
29
29
  filter = SandthornEventFilter::Filter.new(my_events)
30
+ # Or using shorthand
31
+ filter = SandthornEventFilter.filter(my_events)
30
32
 
31
33
  You can always call `.events` to get the filtered events:
32
34
 
33
- # This filter is empty, and will return the original events
35
+ # This filter has no matchers, and will return the original events
34
36
  filter.events
35
37
  # => [...]
36
38
 
@@ -44,7 +46,7 @@ You can also enumerate on the filter directly:
44
46
  new_events.events
45
47
  # => events that match the criteria
46
48
 
47
- `remove` returns a new filter with removes the chosen events:
49
+ `remove` returns a new filter which removes the chosen events:
48
50
 
49
51
  except_new = filter.remove(events: "new")
50
52
  except_new.events
@@ -55,6 +57,7 @@ You can also enumerate on the filter directly:
55
57
  You can also create a filter chain without supplying initial events, and apply that chain to any
56
58
  array of events.
57
59
 
58
- filter = Filter.new.reject(events: "new")
60
+ filter = SandthornEventFilter.filter.reject(events: "new")
59
61
  filter.apply(my_array_of_events)
60
62
  # => [ ... array ... ]
63
+
@@ -30,6 +30,10 @@ module SandthornEventFilter
30
30
  self[:event_name]
31
31
  end
32
32
 
33
+ def sequence_number
34
+ self[:sequence_number]
35
+ end
36
+
33
37
  class << self
34
38
  alias_method :wrap, :new
35
39
  end
@@ -1,13 +1,4 @@
1
- require 'sandthorn_event_filter/matchers/matcher_collection'
2
- require 'sandthorn_event_filter/matchers/matcher'
3
- require 'sandthorn_event_filter/matchers/extract'
4
- require 'sandthorn_event_filter/matchers/attribute_changed_matcher'
5
- require 'sandthorn_event_filter/matchers/not_matcher'
6
- require 'sandthorn_event_filter/matchers/identity_matcher'
7
- require 'sandthorn_event_filter/matchers/aggregate_type_matcher'
8
- require 'sandthorn_event_filter/matchers/event_name_matcher'
9
- require 'sandthorn_event_filter/matchers/block_matcher'
10
- require 'sandthorn_event_filter/matchers/sequence_number_matcher'
1
+ require 'sandthorn_event_filter/matchers'
11
2
 
12
3
  module SandthornEventFilter
13
4
  class Filter
@@ -25,6 +25,7 @@ module SandthornEventFilter
25
25
  add_class_matcher(matchers, options)
26
26
  add_event_name_matcher(matchers, options)
27
27
  add_changed_attributes_matcher(matchers, options)
28
+ add_sequence_number_matcher(matchers, options)
28
29
  matchers
29
30
  end
30
31
 
@@ -46,6 +47,13 @@ module SandthornEventFilter
46
47
  end
47
48
  end
48
49
 
50
+ def add_sequence_number_matcher(matchers, options)
51
+ sequence_number = options[:after_sequence_number]
52
+ unless sequence_number.nil?
53
+ matchers << SequenceNumberMatcher.new(sequence_number)
54
+ end
55
+ end
56
+
49
57
  end
50
58
  end
51
59
  end
@@ -0,0 +1,10 @@
1
+ require 'sandthorn_event_filter/matchers/matcher_collection'
2
+ require 'sandthorn_event_filter/matchers/matcher'
3
+ require 'sandthorn_event_filter/matchers/extract'
4
+ require 'sandthorn_event_filter/matchers/attribute_changed_matcher'
5
+ require 'sandthorn_event_filter/matchers/not_matcher'
6
+ require 'sandthorn_event_filter/matchers/identity_matcher'
7
+ require 'sandthorn_event_filter/matchers/aggregate_type_matcher'
8
+ require 'sandthorn_event_filter/matchers/event_name_matcher'
9
+ require 'sandthorn_event_filter/matchers/block_matcher'
10
+ require 'sandthorn_event_filter/matchers/sequence_number_matcher'
@@ -1,3 +1,3 @@
1
1
  module SandthornEventFilter
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/filter_spec.rb CHANGED
@@ -155,6 +155,15 @@ module SandthornEventFilter
155
155
  end
156
156
  end
157
157
 
158
+ context "when extracting events with after a sequence number" do
159
+ it "should return matching events" do
160
+ filter = Filter.new(events).extract(after_sequence_number: 17)
161
+ filtered = filter.events
162
+ expect(filtered.length).to eq(3)
163
+ filtered.each do |event|
164
+ expect(Event.wrap(event).sequence_number).to be > 17
165
+ end
166
+ end
167
+ end
158
168
  end
159
-
160
169
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sandthorn_event_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesper Josefsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gem-release
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: autotest-standalone
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: dotenv
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '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
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.6'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: codeclimate-test-reporter
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: hamster
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description:
@@ -143,8 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - ".gitignore"
147
- - ".travis.yml"
146
+ - .gitignore
147
+ - .travis.yml
148
148
  - Gemfile
149
149
  - Gemfile.lock
150
150
  - LICENSE.txt
@@ -153,6 +153,7 @@ files:
153
153
  - lib/sandthorn_event_filter.rb
154
154
  - lib/sandthorn_event_filter/event.rb
155
155
  - lib/sandthorn_event_filter/filter.rb
156
+ - lib/sandthorn_event_filter/matchers.rb
156
157
  - lib/sandthorn_event_filter/matchers/aggregate_type_matcher.rb
157
158
  - lib/sandthorn_event_filter/matchers/attribute_changed_matcher.rb
158
159
  - lib/sandthorn_event_filter/matchers/block_matcher.rb
@@ -187,17 +188,17 @@ require_paths:
187
188
  - lib
188
189
  required_ruby_version: !ruby/object:Gem::Requirement
189
190
  requirements:
190
- - - ">="
191
+ - - '>='
191
192
  - !ruby/object:Gem::Version
192
193
  version: '0'
193
194
  required_rubygems_version: !ruby/object:Gem::Requirement
194
195
  requirements:
195
- - - ">="
196
+ - - '>='
196
197
  - !ruby/object:Gem::Version
197
198
  version: '0'
198
199
  requirements: []
199
200
  rubyforge_project:
200
- rubygems_version: 2.2.2
201
+ rubygems_version: 2.0.6
201
202
  signing_key:
202
203
  specification_version: 4
203
204
  summary: Composable filters for Sandthorn Events