Skip to content

Commit 60f5d58

Browse files
committed
Freeze and hide internal constants
1 parent 8f582dc commit 60f5d58

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/pathname_builtin.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ class Pathname
201201
else
202202
proc {|a, b| a == b}
203203
end
204+
SAME_PATHS.freeze
205+
private_constant :SAME_PATHS
204206

205207
attr_reader :path
206208
protected :path
@@ -307,13 +309,17 @@ def sub_ext(repl)
307309
SEPARATOR_LIST = Regexp.quote File::SEPARATOR
308310
SEPARATOR_PAT = /#{SEPARATOR_LIST}/
309311
end
312+
SEPARATOR_LIST.freeze
313+
SEPARATOR_PAT.freeze
314+
private_constant :SEPARATOR_LIST, :SEPARATOR_LIST
310315

311316
if File.dirname('A:') == 'A:.' # DOSish drive letter
312317
# Regexp that matches an absolute path.
313318
ABSOLUTE_PATH = /\A(?:[A-Za-z]:|#{SEPARATOR_PAT})/
314319
else
315320
ABSOLUTE_PATH = /\A#{SEPARATOR_PAT}/
316321
end
322+
ABSOLUTE_PATH.freeze
317323
private_constant :ABSOLUTE_PATH
318324

319325
# :startdoc:

0 commit comments

Comments
 (0)