Sha256: c1631041da3fdaf9bd021826335bb58ecc5dc518d89418eeb7606f3bf6f43b85

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true
require "zlib"

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

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

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

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

    def name
      relative_path.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
theme-check-1.6.1 lib/theme_check/asset_file.rb
theme-check-1.6.0 lib/theme_check/asset_file.rb