Class: Alerty::Plugin::File

Inherits:
Object
  • Object
show all
Defined in:
lib/alerty/plugin/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ File

Returns a new instance of File.

Raises:



6
7
8
9
# File 'lib/alerty/plugin/file.rb', line 6

def initialize(config)
  raise ConfigError.new('file: path is not configured') unless config.path
  @path = config.path
end

Instance Method Details

#alert(record) ⇒ Object



11
12
13
14
15
# File 'lib/alerty/plugin/file.rb', line 11

def alert(record)
  ::File.open(@path, 'a') do |io|
    io.puts record.to_json
  end
end