Sha256: cf36d4bd7b891436916f76ead39c278f99820b46eb5fd948c3717bdad5015332

Contents?: true

Size: 691 Bytes

Versions: 106

Compression:

Stored size: 691 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

106 entries across 86 versions & 10 rubygems

Version Path
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/serializers/process_serializer.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/serializers/process_serializer.rb
yard-0.8.7.3 lib/yard/serializers/process_serializer.rb
yard-0.8.7.2 lib/yard/serializers/process_serializer.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/lib/yard/serializers/process_serializer.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/lib/yard/serializers/process_serializer.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/lib/yard/serializers/process_serializer.rb
yard-0.8.7.1 lib/yard/serializers/process_serializer.rb
yard-0.8.7 lib/yard/serializers/process_serializer.rb
challah-1.0.0 vendor/bundle/gems/yard-0.8.6.1/lib/yard/serializers/process_serializer.rb
yard-0.8.6.2 lib/yard/serializers/process_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.5.2/lib/yard/serializers/process_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6.1/lib/yard/serializers/process_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6/lib/yard/serializers/process_serializer.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/yard-0.8.6.1/lib/yard/serializers/process_serializer.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/yard-0.8.6.1/lib/yard/serializers/process_serializer.rb
yard-0.8.6.1 lib/yard/serializers/process_serializer.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.6/lib/yard/serializers/process_serializer.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.5.2/lib/yard/serializers/process_serializer.rb
yard-0.8.6 lib/yard/serializers/process_serializer.rb