Class: Epuber::Compiler::FileTypes::GeneratedFile

Inherits:
AbstractFile
  • Object
show all
Defined in:
lib/epuber/compiler/file_types/generated_file.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractFile

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

Instance Method Summary collapse

Methods inherited from AbstractFile

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

Instance Attribute Details

#contentString | #to_s

Returns files content.

Returns:

  • (String | #to_s)

    files content



12
13
14
# File 'lib/epuber/compiler/file_types/generated_file.rb', line 12

def content
  @content
end

Instance Method Details

#process(compilation_context) ⇒ Object

Parameters:



16
17
18
# File 'lib/epuber/compiler/file_types/generated_file.rb', line 16

def process(compilation_context)
  write_generate(content.to_s)
end

#write_generate(content) ⇒ Object



20
21
22
23
24
25
# File 'lib/epuber/compiler/file_types/generated_file.rb', line 20

def write_generate(content)
  if self.class.write_to_file?(content, final_destination_path)
    UI.print_processing_debug_info("Writing generated content to #{pkg_destination_path}")
    self.class.write_to_file!(content, final_destination_path)
  end
end