Sha256: c3a11236aee4baa84ce7b12900e74f645b74aebcd9ed37484436c30e42859c8a

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require "zlib"

module PlatformosCheck
  class AssetFile < AppFile
    DIR_PREFIX = %r{\A/?((marketplace_builder|app)/assets/|(app/)?modules/((\w|-)*)/(private|public)/assets/)}

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

    def remove_extension(path)
      path
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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