class CutePrint::OutlineLabeler
@api private
Public Class Methods
label(formatter, width, label, value)
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 5 def self.label(formatter, width, label, value) new(formatter, width, label, value).labeled end
new(formatter, width, label, value)
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 9 def initialize(formatter, width, label, value) @formatter = formatter @width = width @label = label @value = value end
Public Instance Methods
labeled()
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 16 def labeled [labeled_first_line] + indented_remaining_lines end
Private Instance Methods
indented_remaining_lines()
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 26 def indented_remaining_lines indent = ' ' * @label.size lines.to_a[1..-1].map do |line| indent + line end end
labeled_first_line()
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 22 def labeled_first_line @label + lines.first end
lines()
click to toggle source
# File lib/cute_print/outline_labeler.rb, line 33 def lines @lines ||= @formatter.format(@width - @label.size, @value) end