Class: StaffMessageFormat
- Inherits:
-
Object
- Object
- StaffMessageFormat
- Defined in:
- lib/staff_message_format.rb
Overview
This is used for formatting Suspension/Silencing messages. It can be extended by plugins to provide custom message formats.
Instance Method Summary collapse
-
#after_initialize ⇒ Object
Plugins can overwrite this to munge values before formatting.
-
#format ⇒ Object
Overwrite this to change formatting.
-
#initialize(type, reason, message = nil) ⇒ StaffMessageFormat
constructor
A new instance of StaffMessageFormat.
Constructor Details
#initialize(type, reason, message = nil) ⇒ StaffMessageFormat
Returns a new instance of StaffMessageFormat.
6 7 8 9 10 11 12 |
# File 'lib/staff_message_format.rb', line 6 def initialize(type, reason, = nil) @type = type @reason = reason @message = after_initialize end |
Instance Method Details
#after_initialize ⇒ Object
Plugins can overwrite this to munge values before formatting
15 16 |
# File 'lib/staff_message_format.rb', line 15 def after_initialize end |
#format ⇒ Object
Overwrite this to change formatting
19 20 21 22 23 24 |
# File 'lib/staff_message_format.rb', line 19 def format result = +"" result << @reason if @reason.present? result << "\n\n#{@message}" if @message.present? result end |