Skip to content

Commit 32ed9b8

Browse files
committed
style(enmeshed): tweak Connector::fetch_existing_attribute
This decreases the Assignment Branch Condition size of the method.
1 parent 0ac97a2 commit 32ed9b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/enmeshed/connector.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ def create_attribute(attribute)
2828
# @return [String, nil] The ID of the existing attribute or nil if none was found.
2929
def fetch_existing_attribute(attribute)
3030
response = connection.get('/api/v2/Attributes') do |request|
31-
request.params['content.@type'] = attribute.klass
32-
request.params['content.owner'] = attribute.owner
33-
request.params['content.value.@type'] = attribute.type
31+
request.params.tap do |p|
32+
p['content.@type'] = attribute.klass
33+
p['content.owner'] = attribute.owner
34+
p['content.value.@type'] = attribute.type
35+
end
3436
end
3537
parse_result(response, Attribute).find {|attr| attr.value == attribute.value }&.id
3638
end

0 commit comments

Comments
 (0)