Sha256: 11036a3fa0e263faca72cc58680c647bf3613855a06d6f2570f7ba421245dd90
Contents?: true
Size: 766 Bytes
Versions: 4
Compression:
Stored size: 766 Bytes
Contents
module Gitdocs class Docfile attr_reader :parent, :path, :name, :author, :modified def initialize(path) @path = path @parent = File.dirname(path) @name = File.basename(path) end # within?("parent", "/root/path") => "/root/path/parent" def within?(dir, root) expanded_root = File.expand_path(dir, root) File.expand_path(@parent, root) == expanded_root || File.expand_path(@path, root).include?(expanded_root) end end class Docdir < Docfile attr_accessor :subdirs attr_accessor :files def initialize(path) super @subdirs = [] @files = [] end def items subdirs + files end def parent=(dir) dir.subdirs.push(self) if dir end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gitdocs-0.4.3 | lib/gitdocs/docfile.rb |
gitdocs-0.4.2 | lib/gitdocs/docfile.rb |
gitdocs-0.4.1 | lib/gitdocs/docfile.rb |
gitdocs-0.4.0 | lib/gitdocs/docfile.rb |