struct CrSerializer::ExclusionStrategies::Version
- CrSerializer::ExclusionStrategies::Version
- CrSerializer::ExclusionStrategies::ExclusionStrategy
- Struct
- Value
- Object
Overview
Serialize properties based on a SemanticVersion
string.
It is enabled by default when using CrSerializer::Context#version=
.
class Example
include CrSerializer
def initialize; end
@[CRS::Until("1.0.0")]
property name : String = "Legacy Name"
@[CRS::Since("1.1.0")]
property name2 : String = "New Name"
end
example = Example.new
example.to_json(CrSerializer::SerializationContext.new.version = "0.30.0") # => {"name":"Legacy Name"}
example.to_json(CrSerializer::SerializationContext.new.version = "1.2.0") # => {"name2":"New Name"}
Defined in:
exclusion_strategies/version.crConstructors
Instance Method Summary
-
#skip_property?(metadata : PropertyMetadata, context : Context) : Bool
Returns
true
if a property should NOT be serialized/deserialized. - #version : SemanticVersion
Instance methods inherited from struct CrSerializer::ExclusionStrategies::ExclusionStrategy
skip_property?(metadata : PropertyMetadata, context : Context) : Bool
skip_property?
Constructor methods inherited from struct CrSerializer::ExclusionStrategies::ExclusionStrategy
new
new
Constructor Detail
Instance Method Detail
Returns true
if a property should NOT be serialized/deserialized.