Class: GeneratedAssets::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/generated-assets/manifest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, prefix) ⇒ Manifest

Returns a new instance of Manifest.



10
11
12
13
14
15
16
# File 'lib/generated-assets/manifest.rb', line 10

def initialize(app, prefix)
  @app = app
  @prefix = prefix
  @entries = []
  @before_hooks = []
  @after_hooks = []
end

Instance Attribute Details

#after_hooksObject (readonly)

Returns the value of attribute after_hooks.



8
9
10
# File 'lib/generated-assets/manifest.rb', line 8

def after_hooks
  @after_hooks
end

#appObject (readonly)

Returns the value of attribute app.



7
8
9
# File 'lib/generated-assets/manifest.rb', line 7

def app
  @app
end

#before_hooksObject (readonly)

Returns the value of attribute before_hooks.



8
9
10
# File 'lib/generated-assets/manifest.rb', line 8

def before_hooks
  @before_hooks
end

#entriesObject (readonly)

Returns the value of attribute entries.



7
8
9
# File 'lib/generated-assets/manifest.rb', line 7

def entries
  @entries
end

#prefixObject (readonly)

Returns the value of attribute prefix.



7
8
9
# File 'lib/generated-assets/manifest.rb', line 7

def prefix
  @prefix
end

Instance Method Details

#add(logical_path, options = {}, &block) ⇒ Object



18
19
20
# File 'lib/generated-assets/manifest.rb', line 18

def add(logical_path, options = {}, &block)
  entries << Entry.new(logical_path, block, options)
end

#after_apply(&block) ⇒ Object



35
36
37
# File 'lib/generated-assets/manifest.rb', line 35

def after_apply(&block)
  after_hooks << block
end

#apply!Object



22
23
24
25
26
27
28
29
# File 'lib/generated-assets/manifest.rb', line 22

def apply!
  before_hooks.each(&:call)

  write_files
  add_precompile_paths

  after_hooks.each(&:call)
end

#before_apply(&block) ⇒ Object



31
32
33
# File 'lib/generated-assets/manifest.rb', line 31

def before_apply(&block)
  before_hooks << block
end