class Lecture::Slide::Section

Public Instance Methods

display() click to toggle source
# File lib/lecture/slide/section.rb, line 6
def display
  Center.new(content: content_with_bars).display
end

Private Instance Methods

content_with_bars() click to toggle source
# File lib/lecture/slide/section.rb, line 12
def content_with_bars
  half_count_of_dashes = [1, (max_col_length - 3)].max / 2
  dashes = "─" * half_count_of_dashes

  header_section = "#{dashes}#{Lecture.section_header_text}#{dashes}"
  footer_section = "#{dashes}#{Lecture.section_footer_text}#{dashes}"

  "#{header_section}\n\n#{content}\n\n#{footer_section}"
end
max_col_length() click to toggle source
# File lib/lecture/slide/section.rb, line 22
def max_col_length
  content.each_line.map do |line|
    line.chomp.uncolorize.length
  end.max
end