Sha256: 1473ca9b52a718ca7ec595204cbf9987c53ff3d97e307b3624185389bb584306

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'avm/file_formats/base'
require 'avm/file_formats/file_result'
require 'avm/file_formats/utf8_assert'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacGenericBase0
    class FileFormats
      class Base < ::Avm::FileFormats::Base
        class Apply
          enable_method_class
          common_constructor :file_format, :files

          # @return [Enumerable<Avm::FileFormats::FileResult>]
          def result
            old_content = files.index_with { |f| File.read(f) }
            ::Avm::FileFormats::Utf8Assert.assert_files(files) { file_format.internal_apply(files) }
            files.map { |f| file_result(f, old_content[f]) }
          end

          # @param path [Pathname]
          # @param old_content [String]
          # @return [Avm::FileFormats::FileResult]
          def file_result(file, old_content)
            ::Avm::FileFormats::FileResult.new(file, file_format.class,
                                               old_content != File.read(file))
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
avm-eac_generic_base0-0.14.0 lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.98.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
avm-eac_generic_base0-0.13.0 lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.87.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.84.2 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
avm-eac_generic_base0-0.12.2 lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.84.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.84.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.83.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.82.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.81.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.80.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.79.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.78.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.77.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
avm-eac_generic_base0-0.12.1 lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.77.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb