Module: Geet::Helpers::SummaryHelper

Defined in:
lib/geet/helpers/summary_helper.rb

Instance Method Summary collapse

Instance Method Details

#split_summary(summary) ⇒ Object

Split the summary in title and description. The description is optional, but the title mandatory.



9
10
11
12
13
14
15
16
17
# File 'lib/geet/helpers/summary_helper.rb', line 9

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

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

  # 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