Class: Grok::Match
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Grok::Match
- Includes:
- CGrokMatch
- Defined in:
- lib/grok/pure/match.rb,
lib/grok/c-ext/match.rb
Defined Under Namespace
Modules: CGrokMatch
Instance Attribute Summary collapse
-
#grok ⇒ Object
Returns the value of attribute grok.
-
#match ⇒ Object
Returns the value of attribute match.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#subject_memorypointer ⇒ Object
Placeholder for the FFI::MemoryPointer that we pass to grok_execn() during Grok#match; this should prevent ruby from garbage collecting us until the GrokMatch goes out of scope.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #captures ⇒ Object
- #each_capture ⇒ Object
- #end ⇒ Object
-
#initialize ⇒ Match
constructor
A new instance of Match.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Match
Returns a new instance of Match.
9 10 11 |
# File 'lib/grok/pure/match.rb', line 9 def initialize @captures = nil end |
Instance Attribute Details
#grok ⇒ Object
Returns the value of attribute grok.
5 6 7 |
# File 'lib/grok/pure/match.rb', line 5 def grok @grok end |
#match ⇒ Object
Returns the value of attribute match.
6 7 8 |
# File 'lib/grok/pure/match.rb', line 6 def match @match end |
#subject ⇒ Object
Returns the value of attribute subject.
4 5 6 |
# File 'lib/grok/pure/match.rb', line 4 def subject @subject end |
#subject_memorypointer ⇒ Object
Placeholder for the FFI::MemoryPointer that we pass to grok_execn() during Grok#match; this should prevent ruby from garbage collecting us until the GrokMatch goes out of scope. code.google.com/p/logstash/issues/detail?id=47
28 29 30 |
# File 'lib/grok/c-ext/match.rb', line 28 def subject_memorypointer @subject_memorypointer end |
Instance Method Details
#[](name) ⇒ Object
30 31 32 |
# File 'lib/grok/pure/match.rb', line 30 def [](name) return captures[name] end |
#captures ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/grok/pure/match.rb', line 19 def captures if @captures.nil? @captures = Hash.new { |h,k| h[k] = [] } each_capture do |key, val| @captures[key] << val end end return @captures end |
#each_capture ⇒ Object
14 15 16 |
# File 'lib/grok/pure/match.rb', line 14 def each_capture(&block) @grok.capture(@match, &block) end |
#end ⇒ Object
72 73 74 |
# File 'lib/grok/c-ext/match.rb', line 72 def end return self[:end] end |
#start ⇒ Object
67 68 69 |
# File 'lib/grok/c-ext/match.rb', line 67 def start return self[:start] end |