Class: ActiveModel::DefaultSerializer
- Inherits:
-
Object
- Object
- ActiveModel::DefaultSerializer
- Defined in:
- lib/active_model/serializer.rb
Overview
DefaultSerializer
Provides a constant interface for all items, particularly for ArraySerializer.
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(object, options = {}) ⇒ DefaultSerializer
constructor
A new instance of DefaultSerializer.
- #serializable_hash ⇒ Object
Constructor Details
#initialize(object, options = {}) ⇒ DefaultSerializer
Returns a new instance of DefaultSerializer.
507 508 509 |
# File 'lib/active_model/serializer.rb', line 507 def initialize(object, ={}) @object, @options = object, end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
505 506 507 |
# File 'lib/active_model/serializer.rb', line 505 def object @object end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
505 506 507 |
# File 'lib/active_model/serializer.rb', line 505 def @options end |
Instance Method Details
#serializable_hash ⇒ Object
511 512 513 |
# File 'lib/active_model/serializer.rb', line 511 def serializable_hash @object.as_json(@options) end |