Skip to content

Commit 05f70de

Browse files
committed
book: simplify file writing
The `File.write(path, content)` form is quite a bit more readable than the long form. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7371b20 commit 05f70de

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

script/book.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,10 @@ def save
156156
end
157157

158158
front_matter = { "redirect_to" => "book/#{@language_code}/v#{@edition}" }
159-
File.open(self.absolute_path("../_index.html"), 'w') do |file|
160-
file.write(self.wrap_front_matter(front_matter))
161-
end
159+
File.write(self.absolute_path("../_index.html"), self.wrap_front_matter(front_matter))
162160

163161
if @language_code == "en"
164-
File.open(self.absolute_path("../../_index.html"), 'w') do |file|
165-
file.write(self.wrap_front_matter(front_matter))
166-
end
162+
File.write(self.absolute_path("../../_index.html"), self.wrap_front_matter(front_matter))
167163
end
168164

169165
FileUtils.mkdir_p(self.absolute_path("ch00"))

0 commit comments

Comments
 (0)