Class: Observed::BuiltinPlugins::File
- Defined in:
- lib/observed/builtin_plugins/file.rb
Constant Summary collapse
- UNDEFINED =
Object.new
Instance Method Summary collapse
Methods included from Reporter::ReportFormatting
Methods included from Configurable
#configure, #get_attribute_value, #has_attribute_value?, included, #initialize
Methods included from Reporter::RegexpMatching
Methods inherited from Reporter
Methods included from Pluggable
Instance Method Details
#report(tag, time, data) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/observed/builtin_plugins/file.rb', line 21 def report(tag, time, data) formatted_data = format_report(tag, time, data) mode = case self.mode when :append, 'a' 'a' when :overwrite, 'w' 'w' else fail "Unsupported value for the parameter `:mode`: Supported values are :append, :overwrite, " + "'a', 'w'. The specified value is #{self.mode.inspect}" end ::File.open(path, mode) do |f| f.puts formatted_data end end |