Class: Soapstone::MessagePresenter
- Inherits:
-
Object
- Object
- Soapstone::MessagePresenter
- Defined in:
- lib/soapstone/core/message_presenter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(message) ⇒ MessagePresenter
constructor
A new instance of MessagePresenter.
- #wrap_message(text) ⇒ Object
Constructor Details
#initialize(message) ⇒ MessagePresenter
Returns a new instance of MessagePresenter.
6 7 8 |
# File 'lib/soapstone/core/message_presenter.rb', line 6 def initialize() @message = end |
Class Method Details
.call(message) ⇒ Object
2 3 4 |
# File 'lib/soapstone/core/message_presenter.rb', line 2 def self.call() new().call end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/soapstone/core/message_presenter.rb', line 10 def call .then(&method(:wrap_message)) .then(&method(:format_lists)) .then(&method(:enhance_typography)) .then(&method(:format_subject_line)) end |
#wrap_message(text) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/soapstone/core/message_presenter.rb', line 18 def (text) subject, body = split_subject_and_body(text) if subject.nil? # single line message or no clear body structure Strings.wrap(body, 72) elsif body.strip.empty? subject else "#{subject}\n\n#{wrap_body(body)}" end end |