lib/basic_serializer.rb in basic_serializer-0.1.4 vs lib/basic_serializer.rb in basic_serializer-0.1.5

- old
+ new

@@ -29,20 +29,20 @@ end alias as_json stringified_attributes def to_json(*_args) - pretty = self.class.instance_variable_get(:@pretty) + pretty = self.class.instance_variable_get(:@format)&.dig(:pretty) Oj.dump(stringified_attributes, **(pretty ? Config::OJ_FORMAT : {})) end def to_yaml YAML.dump(stringified_attributes) end def serialize - case self.class.instance_variable_get(:@format) + case self.class.instance_variable_get(:@format)&.dig(:name) when :json then to_json when :yaml then to_yaml else stringified_attributes end end