Class: Nanoc::External::Filter

Inherits:
Filter
  • Object
show all
Defined in:
lib/nanoc/external/filter.rb

Instance Method Summary collapse

Instance Method Details

#run(content, params = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/nanoc/external/filter.rb', line 7

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