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

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

Instance Method Summary collapse

Methods inherited from AbstractFile

#==, 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



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

def content
  @content
end

Instance Method Details

#process(_compilation_context) ⇒ Object

Parameters:



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

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

#write_generate(content) ⇒ Object



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

def write_generate(content)
  if self.class.write_to_file?(content, final_destination_path)
    UI.print_processing_debug_info("#{pkg_destination_path}: Writing generated content")
    self.class.write_to_file!(content, final_destination_path)
  else
    UI.print_processing_debug_info("#{pkg_destination_path}: Not writing to disk ... generated content is same")
  end
end