Skip to content

Commit

Permalink
warning: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stackmystack committed Dec 20, 2024
1 parent 0a076c5 commit ac6f309
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [unreleased]

## Release v2.3.1/v1.5.1 (20-12-2024)

- Fallback to Ruby's Warning module if ActiveSupport doesn't exist. Relevant for old Rails versions.
- Added documentation on how to _"properly"_ configure the deprecator in a Rails application.

## Release v2.3.0/v1.5.0 (19-12-2024)

- Use ActiveSupport's deprecation machinery instead of Ruby's Warning module.
Expand Down
2 changes: 1 addition & 1 deletion lib/arel_extensions/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ArelExtensions
VERSION = '2.3.0'.freeze
VERSION = '2.3.1'.freeze
end
17 changes: 12 additions & 5 deletions lib/arel_extensions/warning.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
module ArelExtensions
if RUBY_VERSION.split('.')[0].to_i < 3
class RubyDeprecator
class RubyDeprecator
if RUBY_VERSION.split('.')[0].to_i < 3
def warn msg
Kernel.warn(msg)
end
end
else
class RubyDeprecator
else
def warn msg
Kernel.warn(msg, category: :deprecated)
end
end
end

# To configure deprecations in a Rails application, you can do something
# like this:
#
# ```ruby
# ArelExtensions.deprecator.behavior =
# (Rails.application.config.active_support.deprecation || :stderr)
# ```
#
# See ActiveSupport's deprecation documentation for more details.
def self.deprecator
@deprecator ||=
if defined?(ActiveSupport::Deprecation)
Expand Down
2 changes: 1 addition & 1 deletion version_v1.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ArelExtensions
VERSION = '1.5.0'.freeze
VERSION = '1.5.1'.freeze
end
2 changes: 1 addition & 1 deletion version_v2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ArelExtensions
VERSION = '2.3.0'.freeze
VERSION = '2.3.1'.freeze
end

0 comments on commit ac6f309

Please sign in to comment.