Class: Worldwide::Punctuation
- Inherits:
-
Object
- Object
- Worldwide::Punctuation
- Defined in:
- lib/worldwide/punctuation.rb
Class Method Summary collapse
- .end_sentence(input, locale: I18n.locale) ⇒ Object
- .to_paragraph(sentences, locale: I18n.locale) ⇒ Object
Class Method Details
.end_sentence(input, locale: I18n.locale) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/worldwide/punctuation.rb', line 12 def end_sentence(input, locale: I18n.locale) I18n.with_locale(locale) do result = strip_terminal_spaces(input) return result if result.end_with?(full_stop) "#{result}#{full_stop}" end end |
.to_paragraph(sentences, locale: I18n.locale) ⇒ Object
6 7 8 9 10 |
# File 'lib/worldwide/punctuation.rb', line 6 def to_paragraph(sentences, locale: I18n.locale) I18n.with_locale(locale) do sentences.map { |sentence| end_sentence(sentence) }.join(terminal_space) end end |