Class: ThemeCheck::AssetFile
- Inherits:
-
Object
- Object
- ThemeCheck::AssetFile
- Defined in:
- lib/theme_check/asset_file.rb
Instance Method Summary collapse
- #content ⇒ Object
- #gzipped_size ⇒ Object
-
#initialize(relative_path, storage) ⇒ AssetFile
constructor
A new instance of AssetFile.
- #name ⇒ Object
- #path ⇒ Object
- #relative_path ⇒ Object
Constructor Details
#initialize(relative_path, storage) ⇒ AssetFile
Returns a new instance of AssetFile.
7 8 9 10 11 12 |
# File 'lib/theme_check/asset_file.rb', line 7 def initialize(relative_path, storage) @relative_path = relative_path @storage = storage @loaded = false @content = nil end |
Instance Method Details
#content ⇒ Object
22 23 24 |
# File 'lib/theme_check/asset_file.rb', line 22 def content @content ||= @storage.read(@relative_path) end |
#gzipped_size ⇒ Object
26 27 28 |
# File 'lib/theme_check/asset_file.rb', line 26 def gzipped_size @gzipped_size ||= Zlib.gzip(content).bytesize end |
#name ⇒ Object
30 31 32 |
# File 'lib/theme_check/asset_file.rb', line 30 def name relative_path.to_s end |
#path ⇒ Object
14 15 16 |
# File 'lib/theme_check/asset_file.rb', line 14 def path @storage.path(@relative_path) end |
#relative_path ⇒ Object
18 19 20 |
# File 'lib/theme_check/asset_file.rb', line 18 def relative_path @relative_pathname ||= Pathname.new(@relative_path) end |