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

Constructor Details

#initialize(digest_path, **options) ⇒ NullSourceFile

Returns a new instance of NullSourceFile.



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/dassets/source_file.rb', line 112

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



136
137
138
139
140
141
142
# File 'lib/dassets/source_file.rb', line 136

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

#compiledObject



124
125
126
# File 'lib/dassets/source_file.rb', line 124

def compiled
  @source_proxy.content
end

#exists?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/dassets/source_file.rb', line 128

def exists?
  @source_proxy.exists?
end

#mtimeObject



132
133
134
# File 'lib/dassets/source_file.rb', line 132

def mtime
  @source_proxy.mtime
end