class StringProcessing::Pipeline

Public Class Methods

define() click to toggle source
# File lib/string_processing.rb, line 6
def self.define
  b = Proc.new
  @@processors = []
  class_eval(&b)

  Class.new do
    @@using = @@processors

    def self.process *thing
      @@using.each{|x| thing = x.call(thing.flatten) }
      thing
    end

  end
end
process(*thing) click to toggle source
# File lib/string_processing.rb, line 14
def self.process *thing
  @@using.each{|x| thing = x.call(thing.flatten) }
  thing
end
using(theblock) click to toggle source
# File lib/string_processing.rb, line 22
def self.using theblock
  @@processors << theblock
end