Skip to content

Commit 8223fb2

Browse files
transclaude
andcommitted
Revert Tee rename, keep Functor
Remove Tee alias — the Functor name is more accurate (it's a higher-order message proxy, not a Unix tee-style fork). Functor may become a separate library in the future. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c2b517a commit 8223fb2

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

HISTORY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ Changes:
1717
* Add `Binding#caller_locations`.
1818
* Add `Range.intersection` and `Range#intersection` for finding the shared
1919
region of multiple ranges. Works with any comparable type.
20-
* Add `Kernel#tee` — block-less method chaining via Tee/Functor, replaces `tap` override.
21-
* Add `Tee` as alias for `Functor` (gradual rename).
20+
* Add `Kernel#tee` — block-less method chaining via Functor, replaces `tap` override.
2221
* Rename `Hash#to_proc` to `Hash#setter` (avoids clash with Ruby 2.3's `Hash#to_proc`
2322
which does key lookup; Facets' version does attribute assignment).
2423
* Consolidate `Array#arrange` and `Array#to_ranges`; `to_ranges` is now primary,

lib/core/facets/functor.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,3 @@ def method_missing(op, *args, &blk)
9090
end
9191

9292
end
93-
94-
# Tee is an alias for Functor. The name comes from the Unix `tee` command,
95-
# which forks a data stream — here it forks a method call for side effects
96-
# while passing the original receiver through. Functor will be gradually
97-
# deprecated in favor of Tee.
98-
Tee = Functor

lib/core/facets/kernel/tap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Facets no longer overrides Kernel#tap. Use Kernel#tee instead
2-
# for the block-less Functor/Tee form.
2+
# for the block-less Functor form.
33
require 'facets/kernel/tee'

lib/core/facets/kernel/tee.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
module Kernel
44

5-
# Returns a Tee (Functor) that intercepts method calls, forwards
5+
# Returns a Functor that intercepts method calls, forwards
66
# them to self for side effects, and returns self. This is like
77
# a block-less version of #tap that allows method chaining.
88
#
99
# YAML.tee.load_file('foo.yml').load_file('bar.yml')
1010
#
11-
# This is analogous to the Unix `tee` command — the data flows
12-
# through while side effects are forked off.
1311

1412
def tee
15-
Tee.new{ |op,*a,&b| self.send(op, *a, &b); self }
13+
Functor.new{ |op,*a,&b| self.send(op, *a, &b); self }
1614
end
1715

1816
end

lib/core/facets/kernel/try.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module Kernel
88
# Unlike regular send, a +NoMethodError+ exception will *not* be raised
99
# if the receiving object is +nil+ (see NilClass#try below).
1010
#
11-
# Compatible with ActiveSupport's #try, plus an additional Tee/Functor
11+
# Compatible with ActiveSupport's #try, plus an additional Functor
1212
# form when called with no arguments and no block.
1313
#
1414
# @example.try(:name) #=> "bob"
1515
# @example.try { |o| o.name } #=> "bob" (ActiveSupport block form)
16-
# @example.try.name #=> "bob" (Facets Tee form)
16+
# @example.try.name #=> "bob" (Facets Functor form)
1717
#
1818
def try(method=nil, *args, &block)
1919
if method
@@ -50,7 +50,7 @@ def try(method=nil, *args, &block)
5050
elsif block_given?
5151
nil
5252
else
53-
Tee.new { nil }
53+
Functor.new { nil }
5454
end
5555
end
5656

@@ -61,7 +61,7 @@ def try!(method=nil, *args, &block)
6161
elsif block_given?
6262
nil
6363
else
64-
Tee.new { nil }
64+
Functor.new { nil }
6565
end
6666
end
6767

0 commit comments

Comments
 (0)