Sha256: f69db38196affec08839af681ff09afcb0e694e05ed6df2c3d5e7493285121c1

Contents?: true

Size: 545 Bytes

Versions: 6

Compression:

Stored size: 545 Bytes

Contents

class Rad::TextUtils::Processor
  def initialize next_processor = nil
    @next_processor = next_processor
  end
  
  protected
    def call_next data, env
      if @next_processor 
        @next_processor.process data, env 
      else
        data
      end
    end
  
    def build_from *processors
      processors.reverse.inject nil do |next_processor, meta|
        klass, args = if meta.is_a? Array
          [meta[0], meta[1..-1]]
        else
          [meta, []]
        end
        klass.new next_processor, *args
      end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rad_kit-0.0.6 lib/kit/text_utils/processor.rb
rad_kit-0.0.5 lib/kit/text_utils/processor.rb
rad_kit-0.0.4 lib/kit/text_utils/processor.rb
rad_kit-0.0.3 lib/kit/text_utils/processor.rb
rad_kit-0.0.2 lib/kit/text_utils/processor.rb
rad_kit-0.0.1 lib/kit/text_utils/processor.rb