Class: ActiveAdmin::Chat::MessagePresenter
- Inherits:
-
Object
- Object
- ActiveAdmin::Chat::MessagePresenter
- Defined in:
- lib/active_admin/chat/message_presenter.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(message) ⇒ MessagePresenter
constructor
A new instance of MessagePresenter.
Constructor Details
#initialize(message) ⇒ MessagePresenter
Returns a new instance of MessagePresenter.
6 7 8 |
# File 'lib/active_admin/chat/message_presenter.rb', line 6 def initialize() = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/active_admin/chat/message_presenter.rb', line 4 def end |
Class Method Details
.all(messages) ⇒ Object
10 11 12 |
# File 'lib/active_admin/chat/message_presenter.rb', line 10 def self.all() { messages: .map { |m| new(m) } } end |
Instance Method Details
#as_json ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/active_admin/chat/message_presenter.rb', line 14 def as_json(*) { id: .id, message: .content, date: .created_at.iso8601(3), is_admin: .sender.class == ActiveAdmin::Chat.admin_user_klass } end |