Method: ADSP::Stream::WriterHelpers#puts

Defined in:
lib/adsp/stream/writer_helpers.rb

#puts(*objects) ⇒ Object

Writes objects to stream.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/adsp/stream/writer_helpers.rb', line 54

def puts(*objects)
  objects.each do |object|
    if object.is_a? ::Array
      puts(*object)
      next
    end

    source  = object.to_s
    newline = "\n".encode source.encoding

    # Do not add newline if source ends with newline.
    if source.end_with? newline
      write source
    else
      write source + newline
    end
  end

  nil
end