Skip to content
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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Changes:
marks the more dangerous method, and quietly ignoring a missing method is
the dangerous behavior. The docs no longer claim ActiveSupport
compatibility.
* `require 'facets'` no longer loads `Kernel#with`, since a global `with`
breaks other libraries' methods of that name, such as RSpec's
`receive(...).with` (#290). It is still available, deprecated, with
`require 'facets/kernel/with'`.
* `Kernel#try` no longer calls private methods. It now behaves exactly like
a normal call or `&.`, raising `NoMethodError` for them.

Expand Down
2 changes: 1 addition & 1 deletion lib/core/facets/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
require_relative 'kernel/true.rb'
require_relative 'kernel/try.rb'
require_relative 'kernel/val.rb'
require_relative 'kernel/with.rb'
#require_relative 'kernel/with.rb' # uncommon
require_relative 'kernel/writers.rb'
#require_relative 'kernel/y.rb' # uncommon
require_relative 'kernel/yes.rb'
Expand Down
3 changes: 3 additions & 0 deletions lib/core/facets/kernel/with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module Kernel
# unrelated Object#with that temporarily sets attributes, and this one
# silently replaces it. Scheduled for removal after 2027-09-30.
#
# @uncommon
# require 'facets/kernel/with'
#
def with(obj=self, &block)
warn "Kernel#with is deprecated. Use obj.instance_eval { ... } instead. " \
"It will be removed after 2027-09-30.", uplevel: 1
Expand Down
Loading