Sha256: 7417aa1a9920032fb9126408b4fc85d9ca916e787044573912a84010a8d0fd96
Contents?: true
Size: 919 Bytes
Versions: 7
Compression:
Stored size: 919 Bytes
Contents
module Vedeu module Borders # When a {Vedeu::Borders::Border} has a caption, truncate it if # the caption is longer than the interface is wide, and pad with a # space either side. # # @api private # class Caption < Title # Overwrite the border from # {Vedeu::Borders::Border#build_horizontal} on the bottom border # to include the caption if given. # # @return [Array<Vedeu::Views::Char>] def render return chars if empty? caption_index = 0 chars.each_with_index do |char, index| next if index <= start_index || index > (width - 4) char.border = nil char.value = characters[caption_index] caption_index += 1 end end private # @return [Fixnum] def start_index (width - size) - 4 end end # Caption end # Borders end # Vedeu
Version data entries
7 entries across 7 versions & 1 rubygems