Class: Jenkins::Plugin::Tools::Manifest::Writer
- Inherits:
-
Object
- Object
- Jenkins::Plugin::Tools::Manifest::Writer
- Defined in:
- lib/jenkins/plugin/tools/manifest.rb
Constant Summary collapse
- MAX_LENGTH =
72.to_i
Instance Method Summary collapse
-
#initialize(io) ⇒ Writer
constructor
A new instance of Writer.
- #manifest_truncate(message) ⇒ Object
- #put(key, value) ⇒ Object
Constructor Details
#initialize(io) ⇒ Writer
Returns a new instance of Writer.
54 55 56 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 54 def initialize(io) @io = io end |
Instance Method Details
#manifest_truncate(message) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 62 def manifest_truncate() if .length < MAX_LENGTH return end line = [0 ... MAX_LENGTH] + "\n" offset = MAX_LENGTH while offset < .length line += " #{[offset ... (offset + MAX_LENGTH - 1)]}\n" offset += (MAX_LENGTH - 1) end return line end |
#put(key, value) ⇒ Object
58 59 60 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 58 def put(key, value) @io.puts "#{key}: #{manifest_truncate(value)}" end |