Class: AsciidoctorDitaMap::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/dita-map/topic.rb

Direct Known Subclasses

Map

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, attributes = []) ⇒ Topic

Returns a new instance of Topic.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dita-map/topic.rb', line 30

def initialize input, attributes = []
  if input.empty?
    @title = nil
    @type  = nil
  else
    doc = Asciidoctor.load input, safe: :secure, attributes: attributes

    @title = doc.title ? doc.title.gsub(/<[^>]*>/, '') : nil
    @type  = get_content_type doc.attributes
  end
end

Instance Attribute Details

#titleObject

Returns the value of attribute title.



28
29
30
# File 'lib/dita-map/topic.rb', line 28

def title
  @title
end

#typeObject

Returns the value of attribute type.



28
29
30
# File 'lib/dita-map/topic.rb', line 28

def type
  @type
end