Class: WebpackManifest::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/webpack_manifest/manifest.rb

Defined Under Namespace

Classes: MissingEntryError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, cache: false) ⇒ Manifest

Returns a new instance of Manifest.



12
13
14
15
# File 'lib/webpack_manifest/manifest.rb', line 12

def initialize(path, cache: false)
  @path = path
  @cache = cache
end

Instance Attribute Details

#cache=(value) ⇒ Object (writeonly)

Sets the attribute cache

Parameters:

  • value

    the value to set the attribute cache to.



10
11
12
# File 'lib/webpack_manifest/manifest.rb', line 10

def cache=(value)
  @cache = value
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/webpack_manifest/manifest.rb', line 9

def path
  @path
end

Instance Method Details

#assetsObject



25
26
27
# File 'lib/webpack_manifest/manifest.rb', line 25

def assets
  data.values
end

#cache_enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/webpack_manifest/manifest.rb', line 29

def cache_enabled?
  @cache
end

#find(name) ⇒ Object



21
22
23
# File 'lib/webpack_manifest/manifest.rb', line 21

def find(name)
  data[name.to_s]
end

#lookup!(name) ⇒ Object



17
18
19
# File 'lib/webpack_manifest/manifest.rb', line 17

def lookup!(name)
  find(name) || handle_missing_entry(name)
end