lib/lutaml/model/serialize.rb in lutaml-model-0.3.21 vs lib/lutaml/model/serialize.rb in lutaml-model-0.3.22
- old
+ new
@@ -30,11 +30,12 @@
super
@mappings ||= {}
@attributes ||= {}
- subclass.instance_variable_set(:@attributes, Utils.deep_dup(@attributes))
+ subclass.instance_variable_set(:@attributes,
+ Utils.deep_dup(@attributes))
subclass.instance_variable_set(:@mappings, Utils.deep_dup(@mappings))
subclass.instance_variable_set(:@model, subclass)
end
def model(klass = nil)
@@ -49,21 +50,24 @@
def add_custom_handling_methods_to_model(klass)
Utils.add_boolean_accessor_if_not_defined(klass, :ordered)
Utils.add_boolean_accessor_if_not_defined(klass, :mixed)
Utils.add_accessor_if_not_defined(klass, :element_order)
- Utils.add_method_if_not_defined(klass, :using_default_for) do |attribute_name|
+ Utils.add_method_if_not_defined(klass,
+ :using_default_for) do |attribute_name|
@using_default ||= {}
@using_default[attribute_name] = true
end
- Utils.add_method_if_not_defined(klass, :value_set_for) do |attribute_name|
+ Utils.add_method_if_not_defined(klass,
+ :value_set_for) do |attribute_name|
@using_default ||= {}
@using_default[attribute_name] = false
end
- Utils.add_method_if_not_defined(klass, :using_default?) do |attribute_name|
+ Utils.add_method_if_not_defined(klass,
+ :using_default?) do |attribute_name|
@using_default ||= {}
!!@using_default[attribute_name]
end
end
@@ -444,11 +448,10 @@
attr_accessor :element_order, :schema_location
attr_writer :ordered, :mixed
def initialize(attrs = {})
- @validate_on_set = attrs.delete(:validate_on_set) || false
- @using_default ||= {}
+ @using_default = {}
return unless self.class.attributes
if attrs.is_a?(Lutaml::Model::MappingHash)
@ordered = attrs.ordered?