Commit 78a9afe

mo khan <mo@mokhan.ca>
2022-12-09 17:30:17
refactor: remove duplication
1 parent d665835
Changed files (1)
lib
scim
lib/scim/kit/v2/attributable.rb
@@ -88,19 +88,16 @@ module Scim
         end
 
         def attribute(type, resource)
+          key = type.name
           if dynamic_attributes.key?(type.name)
             key = "#{type.schema&.id}##{type.name}"
-            dynamic_attributes[key] = Attribute.new(
-              type: type,
-              resource: resource
-            )
           else
-            dynamic_attributes[type.name] = Attribute.new(
-              type: type,
-              resource: resource
-            )
             extend(create_module_for(type))
           end
+          dynamic_attributes[key] = Attribute.new(
+            type: type,
+            resource: resource
+          )
         end
       end
     end