jls-grok 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/grok-pure.rb +18 -5
  3. data/lib/grok/pure/match.rb +1 -1
  4. metadata +15 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a87c7ac785b23ed2270f891cfce258dd70fc7ba
4
- data.tar.gz: fe1d3cc3e3c354635a04a92ea345b5ede3abe7bf
3
+ metadata.gz: 08482a47c4de8fe866dcf38f14e41a051b66dd78
4
+ data.tar.gz: eaba493b8bb5f852b127854b5da46f58e3d9fdcf
5
5
  SHA512:
6
- metadata.gz: 1d36517b1e62f89b30ef099fe94e6db34e9a0580680773903ad8e7bee533fcf4f163a9f678170360ab119406e7b8e5e5e764098ba2abcb73703ef1e00112b9bc
7
- data.tar.gz: f1c399a859af294f69c9cb5ab73e32c7b79aaf6c44068510c1e2b115590442ea28e159650df79981992bfacbf4651d6640bb54f5a430411dfa6c5fc74d8d27b2
6
+ metadata.gz: de7ac123d10c520c4bfbfac031a36700c07f92d816ebd2139f498020970d8c5952305a4023b6679fe95fd8ba8550c2f685c00c06a9eafa5a8ea4504e7b40c92f
7
+ data.tar.gz: 97db84ed8aeb7c6285206e2291caa5e410aa74a00b537499dfc6be2bbc93bbff054c5f74b00da5aac5bf77efda2a60f7abf285662c7497ab923a09e5605399a1
@@ -1,4 +1,4 @@
1
- require "rubygems"
1
+ require "rubygems"
2
2
  require "logger"
3
3
  require "cabin"
4
4
  require "grok/pure/discovery"
@@ -172,21 +172,34 @@ class Grok
172
172
  end
173
173
  end # def match
174
174
 
175
+ # Returns the matched regexp object directly for performance at the
176
+ # cost of usability.
177
+ #
178
+ # Returns MatchData on success, nil on failure.
179
+ #
180
+ # Can be used with #capture
181
+ def execute(text)
182
+ @regexp.match(text)
183
+ end
184
+
175
185
  # Optimized match and capture instead of calling them separately
186
+ # This could be DRYed up by using #match and #capture directly
187
+ # but there's a bit of a worry that that may lower perf.
188
+ # This should be benchmarked!
176
189
  def match_and_capture(text)
177
- match = @regexp.match(text)
190
+ match = execute(text)
178
191
  if match
179
192
  @logger.debug? and @logger.debug("Regexp match object", :names => match.names,
180
193
  :captures => match.captures)
181
- @captures_func.call(match) { |k,v| yield k,v }
194
+ capture(match) {|k,v| yield k,v}
182
195
  return true
183
196
  else
184
197
  return false
185
198
  end
186
199
  end # def match_and_capture
187
200
 
188
- def capture(match, block)
189
- @captures_func.call(match) { |k,v| block.call k,v }
201
+ def capture(match, &block)
202
+ @captures_func.call(match,&block)
190
203
  end # def capture
191
204
 
192
205
  public
@@ -12,7 +12,7 @@ class Grok::Match
12
12
 
13
13
  public
14
14
  def each_capture(&block)
15
- @grok.capture(@match, block)
15
+ @grok.capture(@match, &block)
16
16
  end # def each_capture
17
17
 
18
18
  public
metadata CHANGED
@@ -1,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jls-grok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  - Pete Fritchman
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-07 00:00:00.000000000 Z
12
+ date: 2016-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: cabin
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
20
  version: 0.6.0
20
- name: cabin
21
- prerelease: false
22
21
  type: :runtime
22
+ prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.6.0
28
28
  description: Grok ruby bindings - pattern match/extraction tool
@@ -35,33 +35,34 @@ extra_rdoc_files: []
35
35
  files:
36
36
  - lib/grok-pure.rb
37
37
  - lib/grok.rb
38
- - lib/grok/namespace.rb
39
38
  - lib/grok/c-ext/match.rb
40
39
  - lib/grok/c-ext/pile.rb
40
+ - lib/grok/namespace.rb
41
41
  - lib/grok/pure/discovery.rb
42
42
  - lib/grok/pure/match.rb
43
43
  homepage: http://code.google.com/p/semicomplete/wiki/Grok
44
44
  licenses: []
45
45
  metadata: {}
46
- post_install_message:
46
+ post_install_message:
47
47
  rdoc_options: []
48
48
  require_paths:
49
49
  - lib
50
50
  - lib
51
51
  required_ruby_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubyforge_project:
63
- rubygems_version: 2.1.9
64
- signing_key:
62
+ rubyforge_project:
63
+ rubygems_version: 2.4.8
64
+ signing_key:
65
65
  specification_version: 4
66
66
  summary: grok bindings for ruby
67
67
  test_files: []
68
+ has_rdoc: