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, #response_headers, #source

Constructor Details

#initialize(digest_path, options = nil) ⇒ NullSourceFile

Returns a new instance of NullSourceFile.



93
94
95
96
97
98
99
100
101
# File 'lib/dassets/source_file.rb', line 93

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

Instance Method Details

#==(other_source_file) ⇒ Object



107
108
109
# File 'lib/dassets/source_file.rb', line 107

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

#compiledObject



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

def compiled; @source_proxy.content; end

#exists?Boolean

Returns:

  • (Boolean)


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

def exists?;  @source_proxy.exists?; end

#mtimeObject



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

def mtime;    @source_proxy.mtime;   end