Class: Hike::Extensions

Inherits:
NormalizedArray show all
Defined in:
lib/hike/extensions.rb

Overview

`Extensions` is an internal collection for tracking extension names.

Instance Method Summary collapse

Methods inherited from NormalizedArray

#<<, #[]=, #collect!, #initialize, #insert, #normalize_elements, #push, #replace, #unshift

Constructor Details

This class inherits a constructor from Hike::NormalizedArray

Instance Method Details

#normalize_element(extension) ⇒ Object

Extensions added to this array are normalized with a leading `.`.

extensions << "js"
extensions << ".css"

extensions
# => [".js", ".css"]

15
16
17
18
19
20
21
# File 'lib/hike/extensions.rb', line 15

def normalize_element(extension)
  if extension[/^\./]
    extension
  else
    ".#{extension}"
  end
end