aix-errlog 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aix/errlog/errlog.rb +30 -47
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c569d77d9bdcd400b84076c146dee2857479389f5aa587dcd9d94425da40242d
4
- data.tar.gz: 8a88141ae5ddd9d0728421215668c9dc373f3081683d406da1380fa3f3f4ed8a
3
+ metadata.gz: 2a5bf9f5032e8678c2743abee0bc82207e79fe58ab891a8e54fa86cfec4d73b5
4
+ data.tar.gz: 58d752d88e8ec4c746b220185d7d4693bdd7422d040f95a6a3b5ac7a3f496d57
5
5
  SHA512:
6
- metadata.gz: f8dc5bf3b7ec2d0a76093e938f903daa30efa452d0123956bf9169b821f1fc4cc9b364391c6ba954a50597dda8d9a55e361cfa73091defbf3fd405be981c111b
7
- data.tar.gz: 5836a08e5eba18292711936ad8273300acbf05c8a7e3616791fbcabfba35ea6ed9dce273b8375a5ae6abbd2975adc4131231565ec178a8a215950d460dfc825d
6
+ metadata.gz: bc7ff6b6b189b7aa3bee944d81371dd5cfb878d900fdbcb44386162c0d9ec60ba707816374ab9e140cadff5b8ec0bfdd9746f5f31e5acf6d80b3193279a96d3b
7
+ data.tar.gz: 967c2fa36918ad19addb60f2c6183c8d4d0a993c896eed7c7dd785fbe9dc206f36a3067b573288f5301d067adb2c582e397e59c03cf4da3fe10778f77d87e0ef
@@ -46,7 +46,7 @@ module AIX
46
46
  # require 'aix/errlog'
47
47
  #
48
48
  # AIX::Errlog.open do |log|
49
- # log.forward_each(match: log.match {
49
+ # log.forward_each(log.match {
50
50
  # label.include?('KILL') & (
51
51
  # (
52
52
  # (sequence > 1000) &
@@ -142,15 +142,11 @@ module AIX
142
142
  # Enumerate log Entry objects in forward order (default is reverse). If
143
143
  # no block is given, returns an enumerator.
144
144
  #
145
- # sequence specifies the sequence ID to start with. It will be included
146
- # in the results if specifed
147
- #
148
- # match takes a Match object, which specifies which entries to match.
145
+ # The single option is a matcher. It specifies a match if the passed in
146
+ # value is a Match, or a sequence ID otherwise.
149
147
  #
150
- # match and sequence must not be both specified. If neither are
151
- # specified, this simply iterates from the beginning (or from the previous
152
- # stopped position, if #find_sequence or #find_first have already been
153
- # called).
148
+ # sequence specifies the sequence ID to start with. It will be included
149
+ # in the results if specifed. The match is a more complex matcher.
154
150
  #
155
151
  # An active enumerator can not be nested within another active enumerator,
156
152
  # including the block form of this. If you invoke any of the #each_
@@ -161,30 +157,24 @@ module AIX
161
157
  # Warning: if the sequence does not exist (which is common when error logs
162
158
  # are cleaned), no entries will be returned, even if they follow the
163
159
  # sequence ID. If you want all entries based on their sequence number,
164
- # use match instead. You're usually better off using the timestamp
160
+ # use a Match instead. You're usually better off using the timestamp
165
161
  # instead of sequence number, because the sequence number is 32 bits and
166
162
  # might wrap.
167
- def forward_each(match: nil, sequence: nil, &block)
168
- raise 'match and sequence must not be both specified' if match && sequence
169
-
170
- return to_enum(:forward_each, match: match, sequence: sequence) unless block_given?
163
+ def forward_each(matcher=nil, &block)
164
+ return to_enum(:forward_each, matcher) unless block_given?
171
165
  set_direction :forward
172
- each(match: match, sequence: sequence, &block)
166
+ each(matcher, &block)
173
167
  end
174
168
 
175
169
  ##
176
170
  # Enumerate log Entry objects in reverse order (default is reverse). If
177
171
  # no block is given, returns an enumerator.
178
172
  #
179
- # sequence specifies the sequence ID to start with. It will be included
180
- # in the results if specifed
181
- #
182
- # match takes a Match object, which specifies which entries to match.
173
+ # The single option is a matcher. It specifies a match if the passed in
174
+ # value is a Match, or a sequence ID otherwise.
183
175
  #
184
- # match and sequence must not be both specified. If neither are
185
- # specified, this simply iterates from the beginning (or from the previous
186
- # stopped position, if #find_sequence or #find_first have already been
187
- # called).
176
+ # sequence specifies the sequence ID to start with. It will be included
177
+ # in the results if specifed. The match is a more complex matcher.
188
178
  #
189
179
  # An active enumerator can not be nested within another active enumerator,
190
180
  # including the block form of this. If you invoke any of the #each_
@@ -195,15 +185,13 @@ module AIX
195
185
  # Warning: if the sequence does not exist (which is common when error logs
196
186
  # are cleaned), no entries will be returned, even if they follow the
197
187
  # sequence ID. If you want all entries based on their sequence number,
198
- # use match instead. You're usually better off using the timestamp
188
+ # use a Match instead. You're usually better off using the timestamp
199
189
  # instead of sequence number, because the sequence number is 32 bits and
200
190
  # might wrap.
201
- def reverse_each(match: nil, sequence: nil, &block)
202
- raise 'match and sequence must not be both specified' if match && sequence
203
-
204
- return to_enum(:reverse_each, match: match, sequence: sequence) unless block_given?
191
+ def reverse_each(matcher=nil, &block)
192
+ return to_enum(:reverse_each, matcher) unless block_given?
205
193
  set_direction :reverse
206
- each(match: match, sequence: sequence, &block)
194
+ each(matcher, &block)
207
195
  end
208
196
 
209
197
  ##
@@ -283,15 +271,11 @@ module AIX
283
271
  # Enumerate log entries in the order set in #set_direction (default is
284
272
  # reverse).
285
273
  #
286
- # sequence specifies the sequence ID to start with. It will be included
287
- # in the results if specifed
288
- #
289
- # match takes a Match object, which specifies which entries to match.
274
+ # The single option is a matcher. It specifies a match if the passed in
275
+ # value is a Match, or a sequence ID otherwise.
290
276
  #
291
- # match and sequence must not be both specified. If neither are
292
- # specified, this simply iterates from the beginning (or from the previous
293
- # stopped position, if #find_sequence or #find_first have already been
294
- # called).
277
+ # sequence specifies the sequence ID to start with. It will be included
278
+ # in the results if specifed. The match is a more complex matcher.
295
279
  #
296
280
  # An active enumerator can not be nested within another active enumerator,
297
281
  # including the block form of this. If you invoke any of the #each_
@@ -302,12 +286,12 @@ module AIX
302
286
  # Warning: if the sequence does not exist (which is common when error logs
303
287
  # are cleaned), no entries will be returned, even if they follow the
304
288
  # sequence ID. If you want all entries based on their sequence number,
305
- # use match instead. You're usually better off using the timestamp
289
+ # use a Match instead. You're usually better off using the timestamp
306
290
  # instead of sequence number, because the sequence number is 32 bits and
307
291
  # might wrap.
308
292
  #
309
293
  # The user-facing entry points to this are #forward_each and #reverse_each
310
- def each(match: nil, sequence: nil)
294
+ def each(matcher=nil)
311
295
  # Does not return an enumerator, because this will always be called with
312
296
  # an active block
313
297
 
@@ -315,14 +299,13 @@ module AIX
315
299
  raise Errors::EnumeratorError if @enum_active
316
300
  @enum_active = true
317
301
 
318
- if sequence
319
- entry = find_sequence(sequence)
320
- return if entry.nil?
321
- yield entry
322
- end
323
-
324
- if match
325
- entry = find_first(match)
302
+ if matcher
303
+ entry =
304
+ if matcher.is_a? Match
305
+ find_first(matcher)
306
+ else
307
+ find_sequence(matcher)
308
+ end
326
309
  return if entry.nil?
327
310
  yield entry
328
311
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aix-errlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor C. Richberger