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.
35 36 37 38 39 40 |
# File 'lib/udb/obj/manual.rb', line 35 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.
63 64 65 |
# File 'lib/udb/obj/manual.rb', line 63 def path @path end |
Instance Method Details
#fullpath ⇒ Object
52 53 54 55 56 |
# File 'lib/udb/obj/manual.rb', line 52 def fullpath raise "Must call repo_path= first" if @repo_path.nil? @repo_path / @path end |
#name ⇒ Object
42 43 44 |
# File 'lib/udb/obj/manual.rb', line 42 def name @path.basename(".adoc").to_s end |
#repo_path=(path) ⇒ Object
58 59 60 |
# File 'lib/udb/obj/manual.rb', line 58 def repo_path=(path) @repo_path = path end |
#title ⇒ Object
46 47 48 49 50 |
# File 'lib/udb/obj/manual.rb', line 46 def title return @title unless @title.nil? @title = (Asciidoctor.load File.read(fullpath).scrub).doctitle.encode("US-ASCII") end |