Skip to content

Commit e25d5f8

Browse files
transclaude
andcommitted
Review File and Symbol methods
- Deprecate File.null (use File::NULL constant, Ruby 1.9.3+) - Deprecate File.read_binary (use File.binread, Ruby 1.9.3+) - File: 14 remaining methods all unique, no changes needed - Symbol: 14 methods all clean, no changes needed Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4f503e8 commit e25d5f8

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Changes:
103103
* Redefine `String#lchomp` / `#lchomp!` as aliases for `delete_prefix` / `delete_prefix!`.
104104
* Rename `Time#trunc` to `Time#floor_to` (parallels `Time#round_to`; avoids confusion
105105
with Ruby's `Time#floor` which takes sub-second digit precision). `trunc` deprecated.
106+
* Deprecate `File.null` (use `File::NULL` constant, Ruby 1.9.3+).
107+
* Deprecate `File.read_binary` (use `File.binread`, Ruby 1.9.3+).
106108
* Fix dead requires for removed `kernel/singleton_class` in Proc and Kernel.
107109
* Remove misplaced `applique/file_helpers` from core (test infrastructure).
108110
* Drop unused `test_files` directive from gemspec. (PR#301)

lib/core/facets/file/null.rb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
class File
22

3-
# Platform dependent null device.
4-
#
5-
# CREDIT: Daniel Burger
6-
3+
# @deprecated Use File::NULL constant instead (built-in since Ruby 1.9.3).
74
def self.null
8-
case RUBY_PLATFORM
9-
when /mswin/i
10-
'NUL'
11-
when /amiga/i
12-
'NIL:'
13-
when /openvms/i
14-
'NL:'
15-
else
16-
'/dev/null'
17-
end
5+
warn "File.null is deprecated. Use File::NULL instead.", uplevel: 1
6+
File::NULL
187
end
198

209
end
21-
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
class File
22

3-
# Read in a file as binary data.
4-
#
5-
# Assuming we had a binary file 'binary.dat'.
6-
#
7-
# File.read_binary('binary.dat')
8-
#
9-
# CREDIT: George Moschovitis
10-
3+
# @deprecated Use File.binread instead (built-in since Ruby 1.9.3).
114
def self.read_binary(fname)
12-
open(fname, 'rb') do |f|
13-
return f.read
14-
end
5+
warn "File.read_binary is deprecated. Use File.binread instead.", uplevel: 1
6+
binread(fname)
157
end
168

179
end
18-

0 commit comments

Comments
 (0)