Skip to content

Commit

Permalink
Get rid of Kernel#open
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 29, 2023
1 parent c5b0e86 commit dc56f6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ parsed_files = PARSER_FILES.map do |parser_file|
racc = Gem.bin_path 'racc', 'racc'
rb_file = parser_file.gsub(/\.ry\z/, ".rb")
ruby "#{racc} -l -E -o #{rb_file} #{parser_file}"
open(rb_file, 'r+') do |f|
File.open(rb_file, 'r+') do |f|
newtext = "# frozen_string_literal: true\n#{f.read}"
f.rewind
f.write newtext
Expand Down
14 changes: 2 additions & 12 deletions test/rdoc/test_rdoc_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,7 @@ def test_normalized_file_list_with_dot_doc
b = Dir.glob(b).first
c = Dir.glob(c).first

dot_doc = File.expand_path('.document')
FileUtils.touch dot_doc
open(dot_doc, 'w') do |f|
f.puts 'a.rb'
f.puts 'b.rb'
end
File.write('.document', "a.rb\n""b.rb\n")
expected_files << a
expected_files << b

Expand All @@ -196,12 +191,7 @@ def test_normalized_file_list_with_dot_doc_overridden_by_exclude_option
b = Dir.glob(b).first
c = Dir.glob(c).first

dot_doc = File.expand_path('.document')
FileUtils.touch dot_doc
open(dot_doc, 'w') do |f|
f.puts 'a.rb'
f.puts 'b.rb'
end
File.write('.document', "a.rb\n""b.rb\n")
expected_files << a

@rdoc.options.exclude = Regexp.new(['b.rb'].join('|'))
Expand Down

0 comments on commit dc56f6d

Please sign in to comment.