Sha256: d37c546fee04a90df5100a89602b4a557c1e92ebe67f995e23dfd59c4b98b09d

Contents?: true

Size: 342 Bytes

Versions: 2

Compression:

Stored size: 342 Bytes

Contents

class TextUtils::Pipe
  def initialize *processors
    @processor = 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

  def call text
    @processor.call text, {}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 lib/text_utils/pipe.rb
rad_kit-0.0.9 lib/text_utils/pipe.rb