Class: ActiveModel::Pusher::RecordSerializer
- Inherits:
-
Object
- Object
- ActiveModel::Pusher::RecordSerializer
- Defined in:
- lib/active_model/pusher/record_serializer.rb
Defined Under Namespace
Classes: RecordCannotBeSerializedError
Instance Method Summary collapse
-
#initialize(record) ⇒ RecordSerializer
constructor
A new instance of RecordSerializer.
- #serialize! ⇒ Object
Constructor Details
#initialize(record) ⇒ RecordSerializer
Returns a new instance of RecordSerializer.
16 17 18 |
# File 'lib/active_model/pusher/record_serializer.rb', line 16 def initialize(record) @record = record end |
Instance Method Details
#serialize! ⇒ Object
20 21 22 23 24 |
# File 'lib/active_model/pusher/record_serializer.rb', line 20 def serialize! raise RecordCannotBeSerializedError.new(@record) unless can_be_serialized? serializer.as_json end |