Class: Fluent::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern_str, output) ⇒ Match

Returns a new instance of Match.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fluent/match.rb', line 19

def initialize(pattern_str, output)
  patterns = pattern_str.split(/\s+/).map {|str|
    MatchPattern.create(str)
  }
  if patterns.length == 1
    @pattern = patterns[0]
  else
    @pattern = OrMatchPattern.new(patterns)
  end
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



31
32
33
# File 'lib/fluent/match.rb', line 31

def output
  @output
end

Instance Method Details

#emit(tag, es) ⇒ Object



33
34
35
36
# File 'lib/fluent/match.rb', line 33

def emit(tag, es)
  chain = NullOutputChain.instance
  @output.emit(tag, es, chain)
end

#match(tag) ⇒ Object



46
47
48
49
50
51
# File 'lib/fluent/match.rb', line 46

def match(tag)
  if @pattern.match(tag)
    return true
  end
  return false
end

#shutdownObject



42
43
44
# File 'lib/fluent/match.rb', line 42

def shutdown
  @output.shutdown
end

#startObject



38
39
40
# File 'lib/fluent/match.rb', line 38

def start
  @output.start
end