Method: Gitgo::Index#initialize

Defined in:
lib/gitgo/index.rb

#initialize(path) ⇒ Index

Returns a new instance of Index.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/gitgo/index.rb', line 97

def initialize(path)
  @path = path
  @head_file = File.expand_path(HEAD, path)
  @map_file = File.expand_path(MAP, path)
  @list_file = File.expand_path(LIST, path)
  
  @cache = Hash.new do |key_hash, key|
    key_hash[key] = Hash.new do |value_hash, value|
      value_hash[value] = begin
        index = self.path(FILTER, key, value)
        File.file?(index) ? IdxFile.read(index) : []
      end
    end
  end
end