Sha256: 0a53023e53e7532d0a69fae1cd92411bcbf3e0fcfbbb1228a8ca821a6e23c33f

Contents?: true

Size: 635 Bytes

Versions: 18

Compression:

Stored size: 635 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 ||= ThemeFileRewriter.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

18 entries across 18 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/asset_file.rb
theme-check-1.14.0 lib/theme_check/asset_file.rb
theme-check-1.13.0 lib/theme_check/asset_file.rb
theme-check-1.12.1 lib/theme_check/asset_file.rb
theme-check-1.12.0 lib/theme_check/asset_file.rb
theme-check-1.11.0 lib/theme_check/asset_file.rb
theme-check-1.10.3 lib/theme_check/asset_file.rb
theme-check-1.10.2 lib/theme_check/asset_file.rb
theme-check-1.10.1 lib/theme_check/asset_file.rb
theme-check-1.10.0 lib/theme_check/asset_file.rb
theme-check-1.9.2 lib/theme_check/asset_file.rb
theme-check-1.9.1 lib/theme_check/asset_file.rb
theme-check-1.9.0 lib/theme_check/asset_file.rb
theme-check-1.8.0 lib/theme_check/asset_file.rb
theme-check-1.7.2 lib/theme_check/asset_file.rb
theme-check-1.7.1 lib/theme_check/asset_file.rb
theme-check-1.7.0 lib/theme_check/asset_file.rb
theme-check-1.6.2 lib/theme_check/asset_file.rb