Class: Piperun::Pipeline::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/piperun/pipeline.rb,
lib/piperun/filters.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ DSL

Returns a new instance of DSL.



25
26
27
# File 'lib/piperun/pipeline.rb', line 25

def initialize(parent)
  @parent = parent
end

Class Method Details

.add_filter(name, f) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/piperun/pipeline.rb', line 33

def self.add_filter(name, f)
  self.class_eval <<-EVAL
  def #{name}(*args, &block)
    self.filter #{f}.new *args, &block
  end
  EVAL
end

Instance Method Details

#filter(f) ⇒ Object



29
30
31
# File 'lib/piperun/pipeline.rb', line 29

def filter(f)
  @parent.add_filter(f)
end