From da44e858ca24284dde9fcc4a6014f571290364ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 3 Aug 2017 15:23:28 -0400 Subject: 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. --- activestorage/app/models/active_storage/blob.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'activestorage/app') 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: -- cgit v1.2.3