Class: Asciidoctor::PDF::IndexTerm

Inherits:
IndexTermGroup show all
Defined in:
lib/asciidoctor/pdf/index_catalog.rb

Instance Attribute Summary collapse

Attributes inherited from IndexTermGroup

#name

Instance Method Summary collapse

Methods inherited from IndexTermGroup

#<=>, #store_term, #terms

Constructor Details

#initialize(name) ⇒ IndexTerm

Returns a new instance of IndexTerm.



154
155
156
157
158
159
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 154

def initialize name
  super
  @dests = ::Set.new
  @anchor = %(__indextermdef-#{(::Digest::MD5.new << name.to_s).hexdigest})
  @associations = @see = @see_also = nil
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



146
147
148
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 146

def anchor
  @anchor
end

#associationsObject

Returns the value of attribute associations.



148
149
150
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 148

def associations
  @associations
end

#seeObject

Returns the value of attribute see.



150
151
152
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 150

def see
  @see
end

#see_alsoObject



180
181
182
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 180

def see_also
  @see_also&.sort
end

Instance Method Details

#add_dest(dest) ⇒ Object



163
164
165
166
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 163

def add_dest dest
  @dests << dest
  self
end

#container?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 172

def container?
  @dests.empty? || @dests.none? {|d| d.key? :page }
end

#destsObject



168
169
170
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 168

def dests
  @dests.select {|d| d.key? :page }.sort_by {|d| d[:page_sortable] }
end

#leaf?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/asciidoctor/pdf/index_catalog.rb', line 176

def leaf?
  @terms.empty?
end