Class: PBSimply::Hooks::HooksHolderPre

Inherits:
HooksHolder show all
Defined in:
lib/pbsimply/hooks.rb

Overview

Timing Object for pre, process

Instance Method Summary collapse

Methods inherited from HooksHolder

#<<, #add, #cmd, #initialize, #run

Constructor Details

This class inherits a constructor from PBSimply::Hooks::HooksHolder

Instance Method Details

#filter(*cmdarg) ⇒ Object

Invoke command as filter.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pbsimply/hooks.rb', line 48

def filter(*cmdarg)
  proc = ->(arg) do
    IO.popen(cmdarg, "w+") do |io|
      io.print File.read ENV["pbsimply_currentdoc"]
      io.close_write
      File.open(ENV["pbsimply_currentdoc"], "w") do |f|
        f.write io.read
      end
    end
  end
  self << proc
end