Sha256: ab698fbcb10da73b02ed8a6f0b1418be82b1b89c3494e6ee65af79a97a36e69b

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

module Epuber
  class Compiler
    module FileTypes
      require_relative 'abstract_file'

      class GeneratedFile < AbstractFile
        # @return [String | #to_s] files content
        #
        attr_accessor :content

        # @param [Compiler::CompilationContext] compilation_context
        #
        def process(compilation_context)
          write_generate(content.to_s)
        end

        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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
epuber-0.7.4 lib/epuber/compiler/file_types/generated_file.rb
epuber-0.7.3 lib/epuber/compiler/file_types/generated_file.rb
epuber-0.7.2 lib/epuber/compiler/file_types/generated_file.rb
epuber-0.7.1 lib/epuber/compiler/file_types/generated_file.rb
epuber-0.7.0 lib/epuber/compiler/file_types/generated_file.rb