Sha256: 0ff473ed0858d81e2ee5befbae8ac6f684ebf5a7a51f39990ae1df8a80236a8b

Contents?: true

Size: 370 Bytes

Versions: 2

Compression:

Stored size: 370 Bytes

Contents

# frozen_string_literal: true

module Nanoc
  module External
    class Filter < Nanoc::Filter
      identifier :external

      def run(content, params = {})
        cmd   = params.fetch(:exec)
        opts  = params.fetch(:options, [])

        command = TTY::Command.new(printer: :null)
        command.run(cmd, *opts, input: content).out
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-external-1.0.5 lib/nanoc/external/filter.rb
nanoc-external-1.0.4 lib/nanoc/external/filter.rb