Sha256: 463e90815f5bd9eadfcaabc3574480ffbe6f7d8e897ae11f1c46fc18fbf31f0c

Contents?: true

Size: 1.06 KB

Versions: 35

Compression:

Stored size: 1.06 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 = Hash[files.map { |f| [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

35 entries across 35 versions & 2 rubygems

Version Path
eac_tools-0.76.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.76.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.75.2 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.75.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.75.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.74.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.74.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.73.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.72.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.70.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.70.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.69.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.69.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.68.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.67.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.67.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.66.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.65.1 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.65.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
eac_tools-0.64.0 sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb