aix-errlog 2.0.1 → 3.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 +19 -31
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8df66d20a3cba9ed0909fd91b997c29d23dc844bb39b3782a950752cb88d5b09
4
- data.tar.gz: a72992eaddca7507184812f1f3f3d4498b5b1afba1a25d2d11c51fb5852c7e64
3
+ metadata.gz: 404bdf1773251d2dddc2bcbed19fd732aaac713a512aaea3ebfbd223a437d1bc
4
+ data.tar.gz: c255466b7665a34794feca02154e087b5c8f67213256b3c7f26fa3215f78fd5e
5
5
  SHA512:
6
- metadata.gz: 4a28e01edd44092ec36d2835020069fba3cec5c692e2b19922f2824d9bc73c6fc044a84a4b5895fb4faeeeda4579871a7cbe9c68709314ac1f9423448b94b2e4
7
- data.tar.gz: 3d8a73dab5156b94b46e8d4807a3a3e9dd10ebe26e1996c99b26b97bc8fc37164cee46cdad28ecc202a93124b04b91e073aa27867e580fba938b47a361a10c3f
6
+ metadata.gz: b004d8202d1d9ee1b22b283fe436717f4b2f5d8d54b0461556e4cc4469e7cba3000427cd53f61bb19ad52f0f395b272a82571931871c2f6e4dc2e4b2c5a1c0f7
7
+ data.tar.gz: 35020c61378de98cf4edb993527fa4b6bc80552386b46e1c1db777240fff9cb13711a67ed028335d2cd43e50fcb0b19f28faccc1f5d7f7ce2309929f50d0313c
@@ -46,16 +46,16 @@ module AIX
46
46
  # require 'aix/errlog'
47
47
  #
48
48
  # AIX::Errlog.open do |log|
49
- # log.forward_each(log.match {
50
- # label.include?('KILL') & (
49
+ # log.forward_each(log.match {|m|
50
+ # m.label.include?('KILL') & (
51
51
  # (
52
- # (sequence > 1000) &
53
- # (timestamp >= DateTime.new(2017, 1, 1)) &
54
- # (timestamp < DateTime.new(2017, 2, 1))
52
+ # (m.sequence > 1000) &
53
+ # (m.timestamp >= DateTime.new(2017, 1, 1)) &
54
+ # (m.timestamp < DateTime.new(2017, 2, 1))
55
55
  # ) | (
56
- # (sequence < 500) &
57
- # (timestamp >= DateTime.new(2016, 12, 1)) &
58
- # (timestamp < DateTime.new(2017, 1, 1))
56
+ # (m.sequence < 500) &
57
+ # (m.timestamp >= DateTime.new(2016, 12, 1)) &
58
+ # (m.timestamp < DateTime.new(2017, 1, 1))
59
59
  # )
60
60
  # )
61
61
  # }).map(&:label)
@@ -201,33 +201,21 @@ module AIX
201
201
  end
202
202
 
203
203
  ##
204
- # Used to build a match expression using a DSL. This simply calls
205
- # instance_eval on Match, so remember the semantics of block scope. If
206
- # you have a local +sequence+ variable, for instance, you'll need to use
207
- # an explicit self to escape that:
204
+ # Used to build a match expression. This simply yields the Match class.
208
205
  #
209
- # [2] pry(main)> AIX::Errlog::Errlog.match { sequence }
210
- # => #<AIX::Errlog::Match:0xeb32a4df @left=:sequence, @operator=nil, @right=nil>
211
- # [3] pry(main)> sequence = 5
212
- # => 5
213
- # [4] pry(main)> AIX::Errlog::Errlog.match { sequence }
214
- # => 5
215
- # [5] pry(main)> AIX::Errlog::Errlog.match { self.sequence }
216
- # => #<AIX::Errlog::Match:0xcb7d8c03 @left=:sequence, @operator=nil, @right=nil>
217
- # [6] pry(main)> AIX::Errlog::Errlog.match { self.sequence > sequence }
218
- # => #<AIX::Errlog::Match:0x7be0bbf5 @left=:sequence, @operator=:gt, @right=5>
206
+ # A previous version of this used #instance_eval to get a modified self,
207
+ # but that caused some unsavory issues, especially in respect to instance
208
+ # variables:
219
209
  #
220
- # In any case, this function lets you use a block as a shortcut to call a
221
- # bunch of public class methods on the Match class, in order to build
222
- # complex match expressions, as shown in the summary of this class.
210
+ # [1] pry(main)> @x = 7
211
+ # => 7
212
+ # [2] pry(main)> Object.new.instance_eval {@x}
223
213
  #
224
- # Warning: Note that the block for this uses a custom self, through
225
- # +instance_eval+, so you won't be able to access instance variables
226
- # directly. You'll have to put them in through locals. If this isn't a
227
- # good enough tradeoff, you can build the Match object directly through
228
- # its public methods.
214
+ # Essentially, you could not use instance variables in the DSL, so you'd
215
+ # have to reassign everything to locals so they'd be available in the
216
+ # block.
229
217
  def self.match(&block)
230
- Match.instance_eval(&block)
218
+ yield Match
231
219
  end
232
220
 
233
221
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aix-errlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor C. Richberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-24 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi