diff options
Diffstat (limited to 'activestorage/app/models/active_storage/blob.rb')
-rw-r--r-- | activestorage/app/models/active_storage/blob.rb | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb index 9208d36ee3..debc62bd41 100644 --- a/activestorage/app/models/active_storage/blob.rb +++ b/activestorage/app/models/active_storage/blob.rb @@ -1,9 +1,3 @@ -require "active_storage/service" -require "active_storage/filename" -require "active_storage/purge_job" -require "active_storage/variant" -require "active_storage/variation" - # A blob is a record that contains the metadata about a file and a key for where that file resides on the service. # Blobs can be created in two ways: # @@ -85,16 +79,24 @@ class ActiveStorage::Blob < ActiveRecord::Base end # Returns true if the content_type of this blob is in the image range, like image/png. - def image?() content_type =~ /^image/ end + def image? + content_type =~ /^image/ + end # Returns true if the content_type of this blob is in the audio range, like audio/mpeg. - def audio?() content_type =~ /^audio/ end + def audio? + content_type =~ /^audio/ + end # Returns true if the content_type of this blob is in the video range, like video/mp4. - def video?() content_type =~ /^video/ end + def video? + content_type =~ /^video/ + end # Returns true if the content_type of this blob is in the text range, like text/plain. - def text?() content_type =~ /^text/ end + def text? + content_type =~ /^text/ + end # Returns a `ActiveStorage::Variant` instance with the set of `transformations` passed in. This is only relevant # for image files, and it allows any image to be transformed for size, colors, and the like. Example: |