Sha256: d8c576f1042fa0f80134b2699e9292db7a6321dbbbdc3f346a0abd615eb4ebc5

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'yajl'

class RuntimeFileReader

  def initialize(runtime_filename)
    @runtime_filename = runtime_filename || ""
  end

  def old_files
    @old_files ||= unless File.file?(@runtime_filename)
                     []
                   else
                     File.open(@runtime_filename, 'r') do |f|
                       parser = Yajl::Parser.new
                       hash = parser.parse(f)
                       hash.nil? ? [] : hash.keys
                     end
                   end
  end

  def sorted_files(current_files = [])
    (self.old_files+current_files).uniq - (self.old_files-current_files)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gorgon-0.8.2 lib/gorgon/runtime_file_reader.rb