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)

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) ⇒ NullSourceFile

Returns a new instance of NullSourceFile.



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/dassets/source_file.rb', line 101

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

Instance Method Details

#==(other_source_file) ⇒ Object



125
126
127
128
129
130
131
# File 'lib/dassets/source_file.rb', line 125

def ==(other_source_file)
  if other_source_file.is_a?(self.class)
    self.file_path == other_source_file.file_path
  else
    super
  end
end

#compiledObject



113
114
115
# File 'lib/dassets/source_file.rb', line 113

def compiled
  @source_proxy.content
end

#exists?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/dassets/source_file.rb', line 117

def exists?
  @source_proxy.exists?
end

#mtimeObject



121
122
123
# File 'lib/dassets/source_file.rb', line 121

def mtime
  @source_proxy.mtime
end