Skip to content

Commit c236527

Browse files
committed
bugfix in extract-examples.rb by @gkellogg
1 parent a0ddaef commit c236527

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common/extract-examples.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ def save_example(examples:, element:, title:, example_number:, error:, warn:)
511511

512512
# Save example
513513
if example_dir
514-
File.open(File.join(example_dir, ex[:filename]), 'w') {|f| f.write(content)}
514+
file_content = content.respond_to?(:rewind) ? (content.rewind; content.read) : content
515+
File.open(File.join(example_dir, ex[:filename]), 'w') {|f| f.write(file_content)}
516+
content.rewind if content.respond_to?(:rewind)
515517
end
516518

517519
# Save example as YAML

0 commit comments

Comments
 (0)