Sha256: 5d0c0bf87b937f8cc73b35716639486217e380b39b612888a2d4c6c12049f627

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

require 'pathname'

module Concrete

class WorkingSet

  def initialize(root)
    @root = Pathname.new(root).realpath
    @filesByIdent = {}
  end

  def addFile(file)
    @filesByIdent[ident(file)] = file
  end
 
  def removeFile(file)
    @filesByIdent.delete(ident(file)) 
  end

  def fileIdentifiers
    @filesByIdent.keys.sort
  end

  def getFile(fileIdent)
    @filesByIdent[fileIdent]
  end

  def rootPath
    @root.to_s
  end
 
  private
  
  def ident(file)
    Pathname.new(file).realpath.relative_path_from(@root).cleanpath.to_s
  end
     
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concrete-0.2.1 lib/concrete/working_set.rb
concrete-0.2.0 lib/concrete/working_set.rb