Class: WavefrontDisplayPrinter::Base
- Inherits:
-
Object
- Object
- WavefrontDisplayPrinter::Base
- Defined in:
- lib/wavefront-cli/display/printer/base.rb
Overview
Base class for the two printer classes
Instance Attribute Summary collapse
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
-
#key_width(hash = {}, pad = 3) ⇒ Integer
Give it a key-value hash, and it will return the size of the first column to use when formatting that data.
- #to_s ⇒ Object
Instance Attribute Details
#out ⇒ Object (readonly)
Returns the value of attribute out.
6 7 8 |
# File 'lib/wavefront-cli/display/printer/base.rb', line 6 def out @out end |
Instance Method Details
#key_width(hash = {}, pad = 3) ⇒ Integer
Give it a key-value hash, and it will return the size of the first column to use when formatting that data.
15 16 17 18 |
# File 'lib/wavefront-cli/display/printer/base.rb', line 15 def key_width(hash = {}, pad = 3) return 0 if hash.keys.empty? hash.keys.map(&:size).max + pad end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/wavefront-cli/display/printer/base.rb', line 20 def to_s out.join("\n") end |