Sha256: 0285fc5dabae5ff3b0ea708b011ef67f8f84cde44920e4d365a20845502aea2c

Contents?: true

Size: 424 Bytes

Versions: 1

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true

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

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

      cmd_with_opts = [cmd] + opts
      out = StringIO.new
      piper = Nanoc::Extra::Piper.new(stdout: out, stderr: $stderr)
      piper.run(cmd_with_opts, content)
      out.string
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-external-1.0.2 lib/nanoc/external/filter.rb