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.
52 53 54 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 52 def initialize(io) @io = io end |
Instance Method Details
#manifest_truncate(message) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 60 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
56 57 58 |
# File 'lib/jenkins/plugin/tools/manifest.rb', line 56 def put(key, value) @io.puts "#{key}: #{manifest_truncate(value)}" end |