Class: YARD::Serializers::StdoutSerializer

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/serializers/stdout_serializer.rb

Overview

A serializer that writes data to standard output.

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#after_serialize, #before_serialize, #exists?, #serialized_path

Constructor Details

#initialize(wrap = nil) ⇒ StdoutSerializer

Creates a serializer to print text to stdout



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

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

Instance Method Details

#serialize(object, data) ⇒ Object

Overrides serialize behaviour to write data to standard output



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

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