lib/yard/serializers/stdout_serializer.rb in yard-0.9.5 vs lib/yard/serializers/stdout_serializer.rb in yard-0.9.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module YARD
module Serializers
# A serializer that writes data to standard output.
class StdoutSerializer < Base
# Creates a serializer to print text to stdout
@@ -9,24 +10,25 @@
def initialize(wrap = nil)
@wrap = wrap
end
# Overrides serialize behaviour to write data to standard output
- def serialize(object, data)
+ def serialize(_object, data)
print(@wrap ? word_wrap(data, @wrap) : data)
end
private
# Wraps text to a specific column length
#
# @param [String] text the text to wrap
- # @param [Fixnum] length the column length to wrap to
+ # @param [Fixnum] _length the column length to wrap to
# @return [String] the wrapped text
- def word_wrap(text, length = 80)
+ def word_wrap(text, _length = 80)
# See ruby-talk/10655 / Ernest Ellingson
- text.gsub(/\t/," ").gsub(/.{1,50}(?:\s|\Z)/){($& +
- 5.chr).gsub(/\n\005/,"\n").gsub(/\005/,"\n")}
+ text.gsub(/\t/, " ").gsub(/.{1,50}(?:\s|\Z)/) do
+ ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n")
+ end
end
end
end
-end
\ No newline at end of file
+end