diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-08-03 15:23:28 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-08-03 15:23:28 -0400 |
commit | da44e858ca24284dde9fcc4a6014f571290364ea (patch) | |
tree | 6e3e6694c077a8000944b016bc51b1301d0eb72c /activestorage/app | |
parent | 6b40fed4e254ed41a7093b57182259dcefeee3b8 (diff) | |
download | rails-da44e858ca24284dde9fcc4a6014f571290364ea.tar.gz rails-da44e858ca24284dde9fcc4a6014f571290364ea.tar.bz2 rails-da44e858ca24284dde9fcc4a6014f571290364ea.zip |
There is no reason to single line methods here
I know those methods are unlikely to change but having one line method
is hard to read and also hard to modify.
Diffstat (limited to 'activestorage/app')
-rw-r--r-- | activestorage/app/models/active_storage/blob.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb index 9208d36ee3..b5f4342b50 100644 --- a/activestorage/app/models/active_storage/blob.rb +++ b/activestorage/app/models/active_storage/blob.rb @@ -85,16 +85,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: |