lib/spontaneous/paths.rb in spontaneous-0.2.0.beta1 vs lib/spontaneous/paths.rb in spontaneous-0.2.0.beta2
- old
+ new
@@ -2,20 +2,24 @@
require 'pathname'
module Spontaneous
class Paths < ::Hash
+ # TODO: Move this kind of stuff into the Revision class
+ # Instead of throwing around revision numbers we should
+ # be throwing around Revision instances. It is fecking OO
+ # after all...
def self.pad_revision_number(revision)
revision.to_s.rjust(5, "0")
end
def initialize(root)
@root = File.expand_path(root)
- super()
+ super() { |hash, key| hash[key] = [] }
end
def add(category, *paths)
- self[category] = paths
+ self[category].concat(paths)
end
def expanded(category)
self[category].map do |path, glob|
path = Pathname.new(path)