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 "  def \#{name}(*args, &block)\n    self.filter \#{f}.new *args, &block\n  end\n  EVAL\nend\n"

Instance Method Details

#filter(f) ⇒ Object



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

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