Class: Grit::Index
- Inherits:
-
Object
- Object
- Grit::Index
- Defined in:
- lib/grit/index.rb
Overview
Monkey patches an issue in Grit::Index which prevents directories from being cleanly removed from the index and the repository
Instance Method Summary collapse
-
#add(path, data) ⇒ Object
Add (or remove) a file to the index.
Instance Method Details
#add(path, data) ⇒ Object
Add (or remove) a file to the index
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/grit/index.rb', line 14 def add(path, data) is_dir = path[-1].chr == '/' path = path.split('/') filename = path.pop filename += '/' if is_dir current = self.tree path.each do |dir| current[dir] ||= {} node = current[dir] current = node end current[filename] = data end |