Class: Dassets::NullSourceFile

Inherits:
SourceFile show all
Defined in:
lib/dassets/source_file.rb

Overview

A null source file is used to represent source that either doesn’t exist or source that is a proxy (ie a combination)

Defined Under Namespace

Classes: NullSourceProxy

Instance Attribute Summary

Attributes inherited from SourceFile

#file_path

Instance Method Summary collapse

Methods inherited from SourceFile

#asset_file, #digest_path, find_by_digest_path, #source

Constructor Details

#initialize(digest_path, cache = nil) ⇒ NullSourceFile

Returns a new instance of NullSourceFile.



89
90
91
92
93
94
95
96
97
# File 'lib/dassets/source_file.rb', line 89

def initialize(digest_path, cache = nil)
  @file_path, @ext_list = '', []
  @digest_path = digest_path
  @source_proxy = if Dassets.config.combination?(@digest_path)
    SourceProxy.new(@digest_path, cache)
  else
    NullSourceProxy.new
  end
end

Instance Method Details

#==(other_source_file) ⇒ Object



103
104
105
# File 'lib/dassets/source_file.rb', line 103

def ==(other_source_file)
  self.file_path == other_source_file.file_path
end

#compiledObject



99
# File 'lib/dassets/source_file.rb', line 99

def compiled; @source_proxy.content; end

#exists?Boolean

Returns:

  • (Boolean)


100
# File 'lib/dassets/source_file.rb', line 100

def exists?;  @source_proxy.exists?; end

#mtimeObject



101
# File 'lib/dassets/source_file.rb', line 101

def mtime;    @source_proxy.mtime;   end