Class: YARD::Serializers::ProcessSerializer
- Defined in:
- lib/yard/serializers/process_serializer.rb
Overview
Serializes an object to a process (like less)
Instance Method Summary collapse
-
#initialize(cmd) ⇒ ProcessSerializer
constructor
Creates a new ProcessSerializer for the shell command
cmd
. -
#serialize(object, data) ⇒ Object
Overrides serialize behaviour and writes data to standard input of the associated command.
Constructor Details
#initialize(cmd) ⇒ ProcessSerializer
Creates a new ProcessSerializer for the shell command cmd
12 13 14 |
# File 'lib/yard/serializers/process_serializer.rb', line 12 def initialize(cmd) @cmd = cmd end |
Instance Method Details
#serialize(object, data) ⇒ Object
Overrides serialize behaviour and writes data to standard input of the associated command
18 19 20 |
# File 'lib/yard/serializers/process_serializer.rb', line 18 def serialize(object, data) IO.popen(@cmd, 'w') {|io| io.write(data) } end |