You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supports checking String equality:
```ruby
filename = ActiveStorage::Filename.new("file.txt")
filename == "file.txt" # => true
filename in "file.txt" # => true
"file.txt" == filename # => true
```
Prior to this change, tests asserting equality would need to coerce the
`ActiveStorage::Filename` instance to a string:
```ruby
blob = # create ActiveStorage::Blob
assert_equal "file.txt", blob.filename.to_s
```
After this change, the equality check will automatically coerce:
```ruby
blob = # create ActiveStorage::Blob
assert_equal "file.txt", blob.filename
```
As an added benefit, the filename will match in `case` and `if ... in`
statements:
```ruby
blob = # create ActiveStorage::Blob
filename = blob.filename
case filename
when "file.txt" then ...
end
if filename in "file.txt"
# ...
end
```
0 commit comments