Class: Cuprum::Rails::Serializers::Json::PropertiesSerializer::SerializedProperty
- Inherits:
-
Struct
- Object
- Struct
- Cuprum::Rails::Serializers::Json::PropertiesSerializer::SerializedProperty
- Defined in:
- lib/cuprum/rails/serializers/json/properties_serializer.rb
Overview
Data class that configures how an attribute is serialized.
Instance Attribute Summary collapse
-
#mapping ⇒ Object
Returns the value of attribute mapping.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
Instance Method Summary collapse
-
#value_for(object) ⇒ Object
private
Extracts the scoped value from the given object.
Instance Attribute Details
#mapping ⇒ Object
Returns the value of attribute mapping
86 87 88 |
# File 'lib/cuprum/rails/serializers/json/properties_serializer.rb', line 86 def mapping @mapping end |
#name ⇒ Object
Returns the value of attribute name
86 87 88 |
# File 'lib/cuprum/rails/serializers/json/properties_serializer.rb', line 86 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope
86 87 88 |
# File 'lib/cuprum/rails/serializers/json/properties_serializer.rb', line 86 def scope @scope end |
#serializer ⇒ Object
Returns the value of attribute serializer
86 87 88 |
# File 'lib/cuprum/rails/serializers/json/properties_serializer.rb', line 86 def serializer @serializer end |
Instance Method Details
#value_for(object) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracts the scoped value from the given object.
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cuprum/rails/serializers/json/properties_serializer.rb', line 91 def value_for(object) return object if scope.nil? return object.dig(*Array(scope)) if object.respond_to?(:dig) SleepingKingStudios::Tools::Toolbelt .instance .object_tools .dig(object, *Array(scope)) end |