Class: Grok::Match

Inherits:
FFI::Struct
  • Object
show all
Includes:
CGrokMatch
Defined in:
lib/grok/pure/match.rb,
lib/grok/c-ext/match.rb

Defined Under Namespace

Modules: CGrokMatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMatch

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

#grokObject

Returns the value of attribute grok.



5
6
7
# File 'lib/grok/pure/match.rb', line 5

def grok
  @grok
end

#matchObject

Returns the value of attribute match.



6
7
8
# File 'lib/grok/pure/match.rb', line 6

def match
  @match
end

#subjectObject

Returns the value of attribute subject.



4
5
6
# File 'lib/grok/pure/match.rb', line 4

def subject
  @subject
end

#subject_memorypointerObject

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

#capturesObject



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_captureObject



14
15
16
# File 'lib/grok/pure/match.rb', line 14

def each_capture(&block)
  @grok.capture(@match, block)
end

#endObject



72
73
74
# File 'lib/grok/c-ext/match.rb', line 72

def end
  return self[:end]
end

#startObject



67
68
69
# File 'lib/grok/c-ext/match.rb', line 67

def start
  return self[:start]
end