Class: Amrita2::Filters::CommandFilter
- Defined in:
- lib/amrita2/template.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #define_element_method(de, cg, &block) ⇒ Object
-
#initialize(*args) ⇒ CommandFilter
constructor
A new instance of CommandFilter.
Methods inherited from Base
filter_method, inherited, #parse_filter_a, #|
Constructor Details
#initialize(*args) ⇒ CommandFilter
Returns a new instance of CommandFilter.
2459 2460 2461 2462 2463 |
# File 'lib/amrita2/template.rb', line 2459 def initialize(*args) @args = args.collect do |a| a.inspect end.join(' ') end |
Instance Method Details
#define_element_method(de, cg, &block) ⇒ Object
2465 2466 2467 2468 2469 2470 2471 2472 |
# File 'lib/amrita2/template.rb', line 2465 def define_element_method(de, cg, &block) super do block.call cg.code "pipe = IO.popen(#@args, 'r+')" cg.code "pipe.write __stream__; pipe.close_write" cg.code "__stream__ = pipe.read ; pipe.close " end end |