Class: CSKit::Formatters::ScienceHealth::ScienceHealthPlainTextFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/cskit/formatters/science_health/science_health_plain_text_formatter.rb

Direct Known Subclasses

ScienceHealthHtmlFormatter

Constant Summary collapse

SENTENCE_TERMINATOR_REGEX =

semicolon, question mark, or period

/[;\?\.]/
SENTENCE_START_REGEX =

either a period + space, quotes, or start of line followed by the first capital letter or number.

/(\.\s+|\.\"\s+|\.\'\s+|\?\s+|\!\s+|^)[A-Z0-9\"\']/

Instance Attribute Summary

Attributes inherited from Formatter

#options

Instance Method Summary collapse

Methods inherited from Formatter

#initialize

Constructor Details

This class inherits a constructor from CSKit::Formatters::Formatter

Instance Method Details

#format_readings(readings) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cskit/formatters/science_health/science_health_plain_text_formatter.rb', line 15

def format_readings(readings)
  join(
    readings.map do |reading|
      format_lines(reading.texts, reading.citation)
    end
  )
end

#join(texts) ⇒ Object



23
24
25
# File 'lib/cskit/formatters/science_health/science_health_plain_text_formatter.rb', line 23

def join(texts)
  texts.join(separator)
end