Module: Geet::Helpers::SummaryHelper

Extended by:
T::Sig
Includes:
Kernel
Defined in:
lib/geet/helpers/summary_helper.rb

Instance Method Summary collapse

Instance Method Details

#split_summary(summary) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/geet/helpers/summary_helper.rb', line 14

def split_summary(summary)
  raise "Missing title in summary!" if summary.to_s.strip.empty?

  title, description = summary.split(/\r|\n/, 2)

  raise "Title missing" if title.nil?

  # The title may have a residual newline char; the description may not be present,
  # or have multiple blank lines.
  [title.strip, description.to_s.strip]
end