Class: Glyph::Header

Inherits:
Bookmark show all
Defined in:
lib/glyph/bookmark.rb

Overview

This class is used to model bookmark headers

Instance Attribute Summary collapse

Attributes inherited from Bookmark

#definition, #file, #title

Instance Method Summary collapse

Methods inherited from Bookmark

#==, #code, #link, #to_s

Constructor Details

#initialize(hash) ⇒ Header

Initializes the bookmark from a hash. The header hash takes two additional options: :level (the header level within the document), :toc (whether the header should appear in the Table of Contents or not)


81
82
83
84
85
# File 'lib/glyph/bookmark.rb', line 81

def initialize(hash)
	super(hash)
	@level = hash[:level]
	@toc = hash[:toc]
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level


77
78
79
# File 'lib/glyph/bookmark.rb', line 77

def level
  @level
end

Instance Method Details

#toc?Boolean

Returns true if the header is displayed in the Table of contents

Returns:

  • (Boolean)

88
89
90
# File 'lib/glyph/bookmark.rb', line 88

def toc?
	@toc
end