Class: PlatformosCheck::AssetFile
- Inherits:
-
AppFile
- Object
- AppFile
- PlatformosCheck::AssetFile
show all
- Defined in:
- lib/platformos_check/asset_file.rb
Constant Summary
collapse
- DIR_PREFIX =
%r{\A/?((marketplace_builder|app)/assets/|(app/)?modules/((\w|-)*)/(private|public)/assets/)}
Instance Attribute Summary
Attributes inherited from AppFile
#storage, #version
Instance Method Summary
collapse
Methods inherited from AppFile
#==, #build_name, #dir_names, #graphql?, #liquid?, #module_name, #module_original_file?, #module_original_file_path, #module_overwrite_file?, #module_overwrite_file_path, #module_prefix, #name, #page?, #partial?, #path, #relative_path, #source, #translation?, #yaml?
Constructor Details
#initialize(relative_path, storage) ⇒ AssetFile
Returns a new instance of AssetFile.
9
10
11
12
13
|
# File 'lib/platformos_check/asset_file.rb', line 9
def initialize(relative_path, storage)
super
@loaded = false
@content = nil
end
|
Instance Method Details
#dir_prefix ⇒ Object
32
33
34
|
# File 'lib/platformos_check/asset_file.rb', line 32
def dir_prefix
DIR_PREFIX
end
|
#gzipped_size ⇒ Object
28
29
30
|
# File 'lib/platformos_check/asset_file.rb', line 28
def gzipped_size
@gzipped_size ||= Zlib.gzip(source).bytesize
end
|
#remove_extension(path) ⇒ Object
36
37
38
|
# File 'lib/platformos_check/asset_file.rb', line 36
def remove_extension(path)
path
end
|
#rewriter ⇒ Object
15
16
17
|
# File 'lib/platformos_check/asset_file.rb', line 15
def rewriter
@rewriter ||= AppFileRewriter.new(@relative_path, source)
end
|
#write ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/platformos_check/asset_file.rb', line 19
def write
content = rewriter.to_s
return unless source != content
@storage.write(@relative_path, content.gsub("\n", @eol))
@source = content
@rewriter = nil
end
|