Class: PositionFile

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

Instance Method Summary collapse

Constructor Details

#initialize(pos_file_path) ⇒ PositionFile

Returns a new instance of PositionFile.



3
4
5
# File 'lib/fluent/plugin/position_file.rb', line 3

def initialize(pos_file_path)
  @pos_file_path = pos_file_path
end

Instance Method Details

#processed?(violation) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/fluent/plugin/position_file.rb', line 7

def processed?(violation)
  File.exist?(pos_file_name(violation)) && found?(violation)
end

#write(violation) ⇒ Object



11
12
13
14
15
16
# File 'lib/fluent/plugin/position_file.rb', line 11

def write(violation)
  File.open(pos_file_name(violation), 'a') do |f|
    f << violation_entry(violation)
    f << "\n"
  end
end