Sha256: a142ef74e5cac377c3e5f80ee22333e80964520e99b81ae8e6383c3eaf793104

Contents?: true

Size: 472 Bytes

Versions: 5

Compression:

Stored size: 472 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 write(message)
    file.write(message)
    file.flush
  end

  def finalize
    file.close if physical
  end

  private

  attr_reader :file, :physical
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logspot-0.6.4 lib/lo_gspot/output/file.rb
logspot-0.6.3 lib/lo_gspot/output/file.rb
logspot-0.6.2 lib/lo_gspot/output/file.rb
logspot-0.6.1 lib/lo_gspot/output/file.rb
logspot-0.6.0 lib/lo_gspot/output/file.rb