Class: ManualChapter

Inherits:
Object
  • Object
show all
Defined in:
lib/arch_obj_models/manual.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathString (readonly)

Returns The absolute path to the chapter.

Returns:

  • (String)

    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

#nameObject



43
44
45
# File 'lib/arch_obj_models/manual.rb', line 43

def name
  File.basename(@path, ".adoc")
end

#titleObject



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