Sha256: 38b40f7c5073a7df544497c43b2caf863fdf1b967973a5a883fdf22692b64cd3
Contents?: true
Size: 699 Bytes
Versions: 4
Compression:
Stored size: 699 Bytes
Contents
module YARD module Serializers # Serializes an object to a process (like less) # # @example Serializing to a pager (less) # serializer = ProcessSerializer.new('less') # serializer.serialize(object, "data!") class ProcessSerializer < Base # Creates a new ProcessSerializer for the shell command +cmd+ # # @param [String] cmd the command that will accept data on stdin def initialize(cmd) @cmd = cmd end # Overrides serialize behaviour and writes data to standard input # of the associated command def serialize(object, data) IO.popen(@cmd, 'w') {|io| io.write(data) } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems