Sha256: 7cfd0e500ff9d47073947b3d4b918b7106d05eb983cf57caf7b5b3519adf63ae

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require "zlib"

module PlatformosCheck
  class AssetFile < AppFile
    def initialize(relative_path, storage)
      super
      @loaded = false
      @content = nil
    end

    def rewriter
      @rewriter ||= AppFileRewriter.new(@relative_path, source)
    end

    def write
      content = rewriter.to_s
      return unless source != content

      @storage.write(@relative_path, content.gsub("\n", @eol))
      @source = content
      @rewriter = nil
    end

    def gzipped_size
      @gzipped_size ||= Zlib.gzip(source).bytesize
    end

    def name
      relative_path.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
platformos-check-0.0.1 lib/platformos_check/asset_file.rb