Class: Gitdocs::Docfile
- Inherits:
-
Object
- Object
- Gitdocs::Docfile
- Defined in:
- lib/gitdocs/docfile.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #dir? ⇒ Boolean
-
#initialize(path) ⇒ Docfile
constructor
A new instance of Docfile.
-
#within?(dir, root) ⇒ Boolean
within?(“parent”, “/root/path”) => “/root/path/parent”.
Constructor Details
#initialize(path) ⇒ Docfile
Returns a new instance of Docfile.
6 7 8 9 10 |
# File 'lib/gitdocs/docfile.rb', line 6 def initialize(path) @path = path @parent = File.dirname(path) @name = File.basename(path) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/gitdocs/docfile.rb', line 4 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/gitdocs/docfile.rb', line 3 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/gitdocs/docfile.rb', line 4 def path @path end |
Instance Method Details
#dir? ⇒ Boolean
19 20 21 |
# File 'lib/gitdocs/docfile.rb', line 19 def dir? File.directory?(@path) end |