summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2022-12-09 10:30:17 -0700
committermo khan <mo@mokhan.ca>2022-12-09 10:30:17 -0700
commit78a9afede3040b4b143e5cc298a2d754345b9173 (patch)
tree528396458bc26fb633df930899817fc5f9bb6f87
parentd665835360adfc59660619a102eaf3c6bb4f9988 (diff)
refactor: remove duplication
-rw-r--r--lib/scim/kit/v2/attributable.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/scim/kit/v2/attributable.rb b/lib/scim/kit/v2/attributable.rb
index 3d23ced..554fa35 100644
--- a/lib/scim/kit/v2/attributable.rb
+++ b/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