Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid false positive from
.try(:internal_resource)
(#980)
* avoid false positive from .try(:internal_resource) Using #try on :internal_resource can yield unexpected results. If the method is undefined, it can return a truthy value instead of the typical nil. E.g. ```ruby Hyrax::FileSet.try(:internal_resource) || 'hi' => #<Dry::Types::Result::Failure input=:internal_resource error=#<Dry::Struct::Error: [Hyrax::FileSet.new] can't convert Symbol into Hash>> ``` * favor #respond_to? over rescuing errors Co-authored-by: Rob Kaufman <[email protected]> --------- Co-authored-by: Rob Kaufman <[email protected]>
- Loading branch information