Skip to content

Commit

Permalink
Remove deprecated SafeBuffer#clone_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Feb 20, 2024
1 parent 08a00be commit 4dcf652
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
4 changes: 4 additions & 0 deletions activesupport/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Remove deprecated `SafeBuffer#clone_empty`.

*Rafael Mendonça França*

* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.

*Rafael Mendonça França*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ def initialize_copy(other)
@html_safe = other.html_safe?
end

def clone_empty # :nodoc:
ActiveSupport.deprecator.warn <<~EOM
ActiveSupport::SafeBuffer#clone_empty is deprecated and will be removed in Rails 7.2.
EOM
self[0, 0]
end

def concat(value)
unless value.nil?
super(implicit_html_escape_interpolated_argument(value))
Expand Down
15 changes: 0 additions & 15 deletions activesupport/test/safe_buffer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,6 @@ def test_titleize
assert_kind_of NilClass, @buffer.slice("chipchop")
end

test "clone_empty returns an empty buffer" do
assert_deprecated(ActiveSupport.deprecator) do
assert_equal "", ActiveSupport::SafeBuffer.new("foo").clone_empty
end
end

test "clone_empty keeps the original dirtiness" do
assert_deprecated(ActiveSupport.deprecator) do
assert_predicate @buffer.clone_empty, :html_safe?
end
assert_deprecated(ActiveSupport.deprecator) do
assert_not_predicate @buffer.gsub!("", "").clone_empty, :html_safe?
end
end

test "Should be safe when sliced if original value was safe" do
new_buffer = @buffer[0, 0]
assert_not_nil new_buffer
Expand Down
2 changes: 2 additions & 0 deletions guides/source/7_2_release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ Please refer to the [Changelog][active-support] for detailed changes.

### Removals

* Remove deprecated `SafeBuffer#clone_empty`.

* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.

* Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
Expand Down

0 comments on commit 4dcf652

Please sign in to comment.