Sha256: 7bc293ada382fe6e9b75def9da583034fa4241597af9c9a361659d74af0e1419

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 Bytes

Contents

class LoGspot::Output::File
  def initialize(arg)
    if arg.is_a?(String)
      @physical = true
      FileUtils.mkdir_p(File.dirname(arg))
      @file = File.open(arg, 'a')
    else
      @physical = false
      @file = arg
    end
  end

  def puts(data)
    file.puts(data[:message])
    file.flush
  end

  def finalize
    file.close if physical
  end

  private

  attr_reader :file, :physical
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logspot-0.5.0 lib/lo_gspot/output/file.rb
logspot-0.4.0 lib/lo_gspot/output/file.rb