lib/spina/attr_json_monkeypatch.rb in spina-2.12.0 vs lib/spina/attr_json_monkeypatch.rb in spina-2.13.0
- old
+ new
@@ -1,15 +1,14 @@
module Spina
- module AttrJsonMonkeypatch
+ module AttrJsonMonkeypatch
extend ActiveSupport::Concern
-
+
included do |base|
extend ClassMethods
end
-
+
module ClassMethods
-
def attr_json_setter_monkeypatch(name)
# Ruby bug in 3.0.0 related to defined?(super) returning true
# https://github.com/jrochkind/attr_json/issues/112
if RUBY_VERSION == "3.0.0" && RUBY_PATCHLEVEL == 0
define_method("#{name}=") do |value|
@@ -19,10 +18,8 @@
attribute_def = self.class.attr_json_registry.fetch(name.to_sym)
public_send(attribute_def.container_attribute)[attribute_def.store_key] = attribute_def.cast(value)
end
end
end
-
end
-
end
-end
\ No newline at end of file
+end