Class: AssetSync::Config::FileExtToMimeTypeOverrides Private

Inherits:
Object
  • Object
show all
Defined in:
lib/asset_sync/config.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeFileExtToMimeTypeOverrides

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FileExtToMimeTypeOverrides.



343
344
345
346
347
348
349
# File 'lib/asset_sync/config.rb', line 343

def initialize
  # The default is to prevent new mime type `application/ecmascript` to be returned
  # which disables compression on some CDNs
  @overrides = {
    "js" => "application/javascript",
  }
end

Instance Method Details

#add(ext, mime_type) ⇒ Object



352
353
354
355
356
357
358
# File 'lib/asset_sync/config.rb', line 352

def add(ext, mime_type)
  # Symbol / Mime type object might be passed in
  # But we want strings only
  @overrides.store(
    ext.to_s, mime_type.to_s,
  )
end

#clearObject



361
362
363
# File 'lib/asset_sync/config.rb', line 361

def clear
  @overrides = {}
end

#fetch(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



372
373
374
# File 'lib/asset_sync/config.rb', line 372

def fetch(key)
  @overrides.fetch(key)
end

#key?(key) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


367
368
369
# File 'lib/asset_sync/config.rb', line 367

def key?(key)
  @overrides.key?(key)
end