Class: Awestruct::Extensions::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/awestruct/extensions/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Pipeline

Returns a new instance of Pipeline.



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

def initialize(&block)
  @extensions = []
  @helpers    = []
  @transformers  = []
  instance_eval &block if block
end

Instance Attribute Details

#after_extensionsObject (readonly)

Returns the value of attribute after_extensions.



12
13
14
# File 'lib/awestruct/extensions/pipeline.rb', line 12

def after_extensions
  @after_extensions
end

#before_extensionsObject (readonly)

Returns the value of attribute before_extensions.



10
11
12
# File 'lib/awestruct/extensions/pipeline.rb', line 10

def before_extensions
  @before_extensions
end

#extensionsObject (readonly)

Returns the value of attribute extensions.



11
12
13
# File 'lib/awestruct/extensions/pipeline.rb', line 11

def extensions
  @extensions
end

#helpersObject (readonly)

Returns the value of attribute helpers.



13
14
15
# File 'lib/awestruct/extensions/pipeline.rb', line 13

def helpers
  @helpers
end

#transformersObject (readonly)

Returns the value of attribute transformers.



14
15
16
# File 'lib/awestruct/extensions/pipeline.rb', line 14

def transformers
  @transformers
end

Instance Method Details

#execute(site) ⇒ Object



36
37
38
39
40
# File 'lib/awestruct/extensions/pipeline.rb', line 36

def execute(site)
  extensions.each do |ext|
    ext.execute( site )
  end
end

#extension(ext) ⇒ Object



23
24
25
26
# File 'lib/awestruct/extensions/pipeline.rb', line 23

def extension(ext)
  @extensions << ext
  ext.transform(@transformers) if ext.respond_to?('transform')
end

#helper(helper) ⇒ Object



28
29
30
# File 'lib/awestruct/extensions/pipeline.rb', line 28

def helper(helper)
  @helpers << helper
end

#transformer(transformer) ⇒ Object



32
33
34
# File 'lib/awestruct/extensions/pipeline.rb', line 32

def transformer(transformer)
  @transformers << transformer
end

#watch(watched_dirs) ⇒ Object



42
43
44
45
46
# File 'lib/awestruct/extensions/pipeline.rb', line 42

def watch(watched_dirs)
  extensions.each do |ext|
    ext.watch( watched_dirs ) if ext.respond_to?('watch')
  end
end