Class: Cheepub::Nav

Inherits:
Object
  • Object
show all
Defined in:
lib/cheepub/nav.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Nav

Returns a new instance of Nav.



8
9
10
11
12
# File 'lib/cheepub/nav.rb', line 8

def initialize(content)
  @content = content
  @root = @body = nil
  parse
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



6
7
8
# File 'lib/cheepub/nav.rb', line 6

def root
  @root
end

Instance Method Details

#to_htmlObject



14
15
16
17
18
19
# File 'lib/cheepub/nav.rb', line 14

def to_html
  template = File.read(File.join(Cheepub::TEMPLATES_DIR, "nav.xhtml.erb"))
  @body = @root.to_html_ol
  erb = ERB.new(template)
  return erb.result(binding)
end