# Class: YARD::Serializers::StdoutSerializer

Inherits:
  Base
  - Object
  - Base
  - YARD::Serializers::StdoutSerializer
  show all

Defined in:
  lib/yard/serializers/stdout_serializer.rb

## Overview

A serializer that writes data to standard output.

## Instance Method Summary collapse

- #initialize(wrap = nil) ⇒ StdoutSerializer constructor

  Creates a serializer to print text to stdout.

- #serialize(_object, data) ⇒ Object

  Overrides serialize behaviour to write data to standard output.

## Constructor Details

### #initialize(wrap = nil) ⇒ `StdoutSerializer`

Creates a serializer to print text to stdout

Parameters:

- wrap (`Fixnum`, `nil`) (defaults to: `nil`) —

  if wrap is a number, wraps text to `wrap` columns, otherwise no wrapping is done.

    10
    11
    12

    # File 'lib/yard/serializers/stdout_serializer.rb', line 10

    def initialize(wrap = nil)
      @wrap = wrap
    end

## Instance Method Details

### #serialize(_object, data) ⇒ `Object`

Overrides serialize behaviour to write data to standard output

    15
    16
    17

    # File 'lib/yard/serializers/stdout_serializer.rb', line 15

    def serialize(_object, data)
      print(@wrap ? word_wrap(data, @wrap) : data)
    end