Class: Giblish::ConversionInfo
- Inherits:
-
Object
- Object
- Giblish::ConversionInfo
- Defined in:
- lib/giblish/conversion_info.rb
Overview
Base class for bundling together data we always cache for each asciidoc file we come across.
Users are expected to use the derived classes.
Direct Known Subclasses
Constant Summary collapse
- @@nof_missing_titles =
0
Instance Attribute Summary collapse
-
#converted ⇒ Object
readonly
Returns the value of attribute converted.
-
#dst_node ⇒ Object
readonly
Returns the value of attribute dst_node.
-
#dst_top ⇒ Object
readonly
Returns the value of attribute dst_top.
-
#src_node ⇒ Object
readonly
Returns the value of attribute src_node.
-
#src_rel_path ⇒ Object
readonly
The relative Pathname from the root dir to the src doc Ex Pathname(“my/subdir/file1.adoc”).
Instance Method Summary collapse
- #docid ⇒ Object
-
#initialize(converted:, src_node:, dst_node:, dst_top:) ⇒ ConversionInfo
constructor
A new instance of ConversionInfo.
-
#src_basename ⇒ Object
- return
-
a String with the basename of the source file.
- #title ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(converted:, src_node:, dst_node:, dst_top:) ⇒ ConversionInfo
Returns a new instance of ConversionInfo.
29 30 31 32 33 34 35 36 37 |
# File 'lib/giblish/conversion_info.rb', line 29 def initialize(converted:, src_node:, dst_node:, dst_top:) @converted = converted @src_node = src_node @dst_node = dst_node @dst_top = dst_top @title = nil @src_rel_path = dst_node.relative_path_from(dst_top).dirname / src_node.pathname.basename end |
Instance Attribute Details
#converted ⇒ Object (readonly)
Returns the value of attribute converted.
21 22 23 |
# File 'lib/giblish/conversion_info.rb', line 21 def converted @converted end |
#dst_node ⇒ Object (readonly)
Returns the value of attribute dst_node.
21 22 23 |
# File 'lib/giblish/conversion_info.rb', line 21 def dst_node @dst_node end |
#dst_top ⇒ Object (readonly)
Returns the value of attribute dst_top.
21 22 23 |
# File 'lib/giblish/conversion_info.rb', line 21 def dst_top @dst_top end |
#src_node ⇒ Object (readonly)
Returns the value of attribute src_node.
21 22 23 |
# File 'lib/giblish/conversion_info.rb', line 21 def src_node @src_node end |
#src_rel_path ⇒ Object (readonly)
The relative Pathname from the root dir to the src doc Ex Pathname(“my/subdir/file1.adoc”)
25 26 27 |
# File 'lib/giblish/conversion_info.rb', line 25 def src_rel_path @src_rel_path end |
Instance Method Details
#docid ⇒ Object
50 51 52 |
# File 'lib/giblish/conversion_info.rb', line 50 def docid nil end |
#src_basename ⇒ Object
- return
-
a String with the basename of the source file
40 41 42 |
# File 'lib/giblish/conversion_info.rb', line 40 def src_basename @src_node.pathname.basename.to_s end |
#title ⇒ Object
44 45 46 47 48 |
# File 'lib/giblish/conversion_info.rb', line 44 def title return @title if @title "NO TITLE FOUND (#{@@nof_missing_titles += 1}) !" end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/giblish/conversion_info.rb', line 54 def to_s "Conversion #{@converted ? "succeeded" : "failed"} - src: #{@src_node.pathname} dst: #{@dst_node.pathname}" end |