Class: Epuber::Compiler::FileTypes::NavAbstractFile

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

Direct Known Subclasses

NavFile, NcxFile

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(filename, generator_type, properties = []) ⇒ NavAbstractFile

Returns a new instance of NavAbstractFile.

Parameters:

  • filename (String)
  • generator (Class)

    Class of generator (subclass of Epuber::Compiler::Generator)



16
17
18
19
20
21
22
23
24
# File 'lib/epuber/compiler/file_types/nav_file.rb', line 16

def initialize(filename, generator_type, properties = [])
  super()

  @generator_type = generator_type

  self.properties = properties
  self.destination_path = filename
  self.path_type = :manifest
end

Instance Attribute Details

#generator_typeClass (readonly)

Returns:

  • (Class)


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

def generator_type
  @generator_type
end

Instance Method Details

#process(compilation_context) ⇒ Object

Parameters:



28
29
30
31
32
33
34
# File 'lib/epuber/compiler/file_types/nav_file.rb', line 28

def process(compilation_context)
  result = generator_type.new(compilation_context)
                         .generate
                         .to_s

  write_generate(result)
end