Class: ManualChapter
- Inherits:
-
Object
- Object
- ManualChapter
- Defined in:
- lib/arch_obj_models/manual.rb
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The absolute path to the chapter.
Instance Method Summary collapse
-
#initialize(volume, path) ⇒ ManualChapter
constructor
A new instance of ManualChapter.
- #name ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(volume, path) ⇒ ManualChapter
Returns a new instance of ManualChapter.
33 34 35 36 37 38 39 40 41 |
# File 'lib/arch_obj_models/manual.rb', line 33 def initialize(volume, path) @volume = volume @version = volume.version fullpath = "#{@version.path}/#{path}" raise "Path '#{fullpath}' does not exist" unless File.exist?(fullpath) @path = fullpath end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns The absolute path to the chapter.
54 55 56 |
# File 'lib/arch_obj_models/manual.rb', line 54 def path @path end |
Instance Method Details
#name ⇒ Object
43 44 45 |
# File 'lib/arch_obj_models/manual.rb', line 43 def name File.basename(@path, ".adoc") end |
#title ⇒ Object
47 48 49 50 51 |
# File 'lib/arch_obj_models/manual.rb', line 47 def title return @title unless @title.nil? @title = (Asciidoctor.load File.read(path).scrub).doctitle.encode("US-ASCII") end |