Module: RevManifest

Defined in:
lib/rev_manifest/helper.rb,
lib/rev_manifest/railtie.rb,
lib/rev_manifest/version.rb,
lib/actionview-rev_manifest.rb

Defined Under Namespace

Modules: Helper Classes: Railtie

Constant Summary collapse

VERSION =
"0.2.2"
DEFAULT_ASSET_PUBLIC_DIRECTORIES =
{
  audio:      "/assets/audios",
  font:       "/assets/fonts",
  image:      "/assets/images",
  javascript: "/assets/javascripts",
  stylesheet: "/assets/stylesheets",
  video:      "/assets/videos"
}
DEFAULT_ASSET_PREFIXES =
{
  audio:      "assets/audios/",
  font:       "assets/fonts/",
  image:      "assets/images/",
  javascript: "assets/javascripts/",
  stylesheet: "assets/stylesheets/",
  video:      "assets/videos/"
}
DEFAULT_ASSET_ROOT =
"/"
DEFAULT_MANIFEST_PATH =
"public/assets/rev-manifest.json"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.asset_prefixes=(value) ⇒ Object

Sets the attribute asset_prefixes

Parameters:

  • value

    the value to set the attribute asset_prefixes to.



28
29
30
# File 'lib/actionview-rev_manifest.rb', line 28

def asset_prefixes=(value)
  @asset_prefixes = value
end

.asset_public_directoriesHash

Returns:

  • (Hash)


37
38
39
# File 'lib/actionview-rev_manifest.rb', line 37

def asset_public_directories
  @asset_public_directories || DEFAULT_ASSET_PUBLIC_DIRECTORIES
end

.asset_root=(value) ⇒ Object

Sets the attribute asset_root

Parameters:

  • value

    the value to set the attribute asset_root to.



28
29
30
# File 'lib/actionview-rev_manifest.rb', line 28

def asset_root=(value)
  @asset_root = value
end

.enabled=(value) ⇒ Object (writeonly)

Sets the attribute enabled

Parameters:

  • value

    the value to set the attribute enabled to.



28
29
30
# File 'lib/actionview-rev_manifest.rb', line 28

def enabled=(value)
  @enabled = value
end

.manifest_path=(value) ⇒ Object

Sets the attribute manifest_path

Parameters:

  • value

    the value to set the attribute manifest_path to.



28
29
30
# File 'lib/actionview-rev_manifest.rb', line 28

def manifest_path=(value)
  @manifest_path = value
end

.sources=(value) ⇒ Object (writeonly)

Sets the attribute sources

Parameters:

  • value

    the value to set the attribute sources to.



28
29
30
# File 'lib/actionview-rev_manifest.rb', line 28

def sources=(value)
  @sources = value
end

Class Method Details

.enabled?Boolean

@return [true, false]

Returns:

  • (Boolean)


32
33
34
# File 'lib/actionview-rev_manifest.rb', line 32

def enabled?
  !!@enabled
end

.include?(source) ⇒ true, false

Returns:

  • (true, false)


42
43
44
45
# File 'lib/actionview-rev_manifest.rb', line 42

def include?(source)
  return false unless @sources
  @sources == :all ? true : @sources.include?(source)
end

.resolve(source, options) ⇒ String

Returns:

  • (String)


48
49
50
# File 'lib/actionview-rev_manifest.rb', line 48

def resolve(source, options)
  asset_root + manifest[asset_prefixes[options[:type]] + source]
end