Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate image format methods #2103

Merged
merged 2 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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