Skip to content

Commit

Permalink
Replace try with safe navigation operator
Browse files Browse the repository at this point in the history
Try looks for method defined, but we know the method is defined if the attriute is present.
  • Loading branch information
jcoyne committed Nov 17, 2023
1 parent b19e874 commit 8a0aa94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/embed/purl/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def image?

# @return [Integer]
def size
@file.attributes['size'].try(:value).to_i
@file.attributes['size']&.value.to_i
end

# unused (9/2016) - candidate for removal?
Expand Down

0 comments on commit 8a0aa94

Please sign in to comment.