Skip to content

Commit

Permalink
Merge pull request #2103 from tvdeyen/deprecate-image-format-methods
Browse files Browse the repository at this point in the history
Deprecate image format methods
  • Loading branch information
tvdeyen authored May 18, 2021
2 parents bf0d6ec + d6888ec commit 65f29b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/models/alchemy/picture/transformations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,30 @@ def resize(size, upsample = false)
def landscape_format?
image_file.landscape?
end

alias_method :landscape?, :landscape_format?
deprecate landscape_format?: "Use image_file.landscape? instead", deprecator: Alchemy::Deprecation
deprecate landscape?: "Use image_file.landscape? instead", deprecator: Alchemy::Deprecation

# Returns true if picture's width is smaller than it's height
#
def portrait_format?
image_file.portrait?
end

alias_method :portrait?, :portrait_format?
deprecate portrait_format?: "Use image_file.portrait? instead", deprecator: Alchemy::Deprecation
deprecate portrait?: "Use image_file.portrait? instead", deprecator: Alchemy::Deprecation

# Returns true if picture's width and height is equal
#
def square_format?
image_file.aspect_ratio == 1.0
end

alias_method :square?, :square_format?
deprecate square_format?: "Use image_file.aspect_ratio instead", deprecator: Alchemy::Deprecation
deprecate square?: "Use image_file.aspect_ratio instead", deprecator: Alchemy::Deprecation

# Returns true if the class we're included in has a meaningful render_size attribute
#
Expand Down
2 changes: 1 addition & 1 deletion lib/alchemy/deprecation.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module Alchemy
Deprecation = ActiveSupport::Deprecation.new("7.0", "Alchemy")
Deprecation = ActiveSupport::Deprecation.new("6.1", "Alchemy")
end

0 comments on commit 65f29b4

Please sign in to comment.