lib/gitdocs/docfile.rb in gitdocs-0.4.7 vs lib/gitdocs/docfile.rb in gitdocs-0.4.8
- old
+ new
@@ -1,8 +1,9 @@
module Gitdocs
class Docfile
- attr_reader :parent, :path, :name, :author, :modified
+ attr_accessor :parent
+ attr_reader :path, :name
def initialize(path)
@path = path
@parent = File.dirname(path)
@name = File.basename(path)
@@ -13,33 +14,10 @@
expanded_root = File.expand_path(dir, root)
File.expand_path(@parent, root) == expanded_root ||
File.expand_path(@path, root).include?(expanded_root)
end
- def file?
- true
- end
- end
-
- class Docdir < Docfile
- attr_accessor :subdirs
- attr_accessor :files
-
- def initialize(path)
- super
- @subdirs = []
- @files = []
- end
-
- def items
- (subdirs + files).sort { |a,b| a.name.downcase <=> b.name.downcase }
- end
-
- def parent=(dir)
- dir.subdirs.push(self) if dir
- end
-
- def file?
- false
+ def dir?
+ File.directory?(@path)
end
end
end
\ No newline at end of file