Class: Epuber::Compiler::FileTypes::NavFile

Inherits:
GeneratedFile show all
Defined in:
lib/epuber/compiler/file_types/nav_file.rb

Instance Attribute Summary collapse

Attributes inherited from GeneratedFile

#content

Attributes inherited from AbstractFile

#compilation_context, #destination_path, #final_destination_path, #group, #path_type, #pkg_destination_path, #properties

Instance Method Summary collapse

Methods inherited from GeneratedFile

#write_generate

Methods inherited from AbstractFile

#==, file_copy!, write_to_file, write_to_file!, write_to_file?

Constructor Details

#initialize(epub_version) ⇒ NavFile

Returns a new instance of NavFile.

Parameters:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/epuber/compiler/file_types/nav_file.rb', line 15

def initialize(epub_version)
  super()

  @epub_version = epub_version

  properties << :navigation

  self.destination_path = if epub_version >= 3
                            'nav.xhtml'
                          else
                            'nav.ncx'
                          end

  self.path_type = :manifest
end

Instance Attribute Details

#epub_versionEpuber::Version (readonly)

Returns:



11
12
13
# File 'lib/epuber/compiler/file_types/nav_file.rb', line 11

def epub_version
  @epub_version
end

Instance Method Details

#process(compilation_context) ⇒ Object

Parameters:



33
34
35
36
# File 'lib/epuber/compiler/file_types/nav_file.rb', line 33

def process(compilation_context)
  gen = NavGenerator.new(compilation_context)
  write_generate(gen.generate_nav.to_s)
end