Module: Docbook::Elements::Titled

Overview

Elements that have a displayable title. Default: title.content → info.title.content → nil. Override resolve_title in elements with different title paths.

Instance Method Summary collapse

Instance Method Details

#has_title?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/docbook/elements/concerns/titled.rb', line 17

def has_title?
  (t = resolve_title) && !t.strip.empty?
end

#resolve_titleObject



9
10
11
12
13
14
15
# File 'lib/docbook/elements/concerns/titled.rb', line 9

def resolve_title
  if title&.content
    title.content.join
  elsif info&.title&.content
    info.title.content.join
  end
end

#titled?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/docbook/elements/concerns/titled.rb', line 21

def titled?
  true
end