Class: Udb::ManualChapter
- Inherits:
-
Object
- Object
- Udb::ManualChapter
- Defined in:
- lib/udb/obj/manual.rb
Instance Attribute Summary collapse
-
#path ⇒ Pathname
readonly
The relative path to the chapter.
Instance Method Summary collapse
- #fullpath ⇒ Object
-
#initialize(volume, path) ⇒ ManualChapter
constructor
A new instance of ManualChapter.
- #name ⇒ Object
- #repo_path=(path) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(volume, path) ⇒ ManualChapter
Returns a new instance of ManualChapter.
34 35 36 37 38 39 |
# File 'lib/udb/obj/manual.rb', line 34 def initialize(volume, path) @volume = volume @version = volume.version @path = Pathname.new path end |
Instance Attribute Details
#path ⇒ Pathname (readonly)
Returns The relative path to the chapter.
62 63 64 |
# File 'lib/udb/obj/manual.rb', line 62 def path @path end |
Instance Method Details
#fullpath ⇒ Object
51 52 53 54 55 |
# File 'lib/udb/obj/manual.rb', line 51 def fullpath raise "Must call repo_path= first" if @repo_path.nil? @repo_path / @path end |
#name ⇒ Object
41 42 43 |
# File 'lib/udb/obj/manual.rb', line 41 def name @path.basename(".adoc").to_s end |
#repo_path=(path) ⇒ Object
57 58 59 |
# File 'lib/udb/obj/manual.rb', line 57 def repo_path=(path) @repo_path = path end |
#title ⇒ Object
45 46 47 48 49 |
# File 'lib/udb/obj/manual.rb', line 45 def title return @title unless @title.nil? @title = (Asciidoctor.load File.read(fullpath).scrub).doctitle.encode("US-ASCII") end |