Class: Giblish::DocInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/docinfo.rb

Overview

Container class for bundling together the data we cache for each asciidoc file we come across

Defined Under Namespace

Classes: DocHistory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adoc: nil, dst_root_abs: nil, adoc_stderr: "") ⇒ DocInfo

Returns a new instance of DocInfo.


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/giblish/docinfo.rb', line 28

def initialize(adoc: nil, dst_root_abs: nil, adoc_stderr: "")
  @src_file = nil
  @history = []
  @converted = true
  @stderr = adoc_stderr
  return unless adoc

  # Get the purpose info if it exists
  @purpose_str = get_purpose_info adoc

  # fill in doc meta data
  d_attr = adoc.attributes
  self.src_file = (d_attr["docfile"])
  self.title = (adoc.doctitle)
  @doc_id = d_attr["docid"]
  return if dst_root_abs.nil?

  # Get the relative path beneath the root dir to the doc
  @rel_path = Pathname.new(
    "#{d_attr['outdir']}/#{d_attr['docname']}#{d_attr['docfilesuffix']}".encode("utf-8")
  ).relative_path_from(dst_root_abs)
end

Instance Attribute Details

#convertedObject

Returns the value of attribute converted.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def converted
  @converted
end

#doc_idObject

Returns the value of attribute doc_id.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def doc_id
  @doc_id
end

#error_msgObject

Returns the value of attribute error_msg.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def error_msg
  @error_msg
end

#historyObject

Returns the value of attribute history.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def history
  @history
end

#purpose_strObject

Returns the value of attribute purpose_str.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def purpose_str
  @purpose_str
end

#rel_pathObject (readonly)

Returns the value of attribute rel_path.


13
14
15
# File 'lib/giblish/docinfo.rb', line 13

def rel_path
  @rel_path
end

#src_fileObject

Returns the value of attribute src_file.


13
14
15
# File 'lib/giblish/docinfo.rb', line 13

def src_file
  @src_file
end

#statusObject

Returns the value of attribute status.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def status
  @status
end

#stderrObject

Returns the value of attribute stderr.


12
13
14
# File 'lib/giblish/docinfo.rb', line 12

def stderr
  @stderr
end

#titleObject

Returns the value of attribute title.


13
14
15
# File 'lib/giblish/docinfo.rb', line 13

def title
  @title
end

Instance Method Details

#to_sObject


51
52
53
# File 'lib/giblish/docinfo.rb', line 51

def to_s
  "DocInfo: title: #{@title} src_file: #{@src_file}"
end