Class: Alerty::Plugin::File
- Inherits:
-
Object
- Object
- Alerty::Plugin::File
- Defined in:
- lib/alerty/plugin/file.rb
Instance Method Summary collapse
- #alert(record) ⇒ Object
-
#initialize(config) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(config) ⇒ File
Returns a new instance of File.
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 |