Class: GptTranslate::Generator::DownloadedFile
- Inherits:
-
Jekyll::StaticFile
- Object
- Jekyll::StaticFile
- GptTranslate::Generator::DownloadedFile
- Defined in:
- lib/jekyll-chatgpt-translate/generator.rb
Overview
The file we just downloaded.
Instance Attribute Summary collapse
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
-
#initialize(site, link, html) ⇒ DownloadedFile
constructor
A new instance of DownloadedFile.
- #write(_dest) ⇒ Object
Constructor Details
#initialize(site, link, html) ⇒ DownloadedFile
Returns a new instance of DownloadedFile.
160 161 162 163 164 |
# File 'lib/jekyll-chatgpt-translate/generator.rb', line 160 def initialize(site, link, html) super(site, site.dest, '', link) @html = html @link = link end |
Instance Attribute Details
#link ⇒ Object (readonly)
Returns the value of attribute link.
158 159 160 |
# File 'lib/jekyll-chatgpt-translate/generator.rb', line 158 def link @link end |
Instance Method Details
#write(_dest) ⇒ Object
166 167 168 169 170 171 |
# File 'lib/jekyll-chatgpt-translate/generator.rb', line 166 def write(_dest) FileUtils.mkdir_p(File.dirname(path)) File.write(path, @html) Jekyll.logger.info("Saved #{@html.split.count} words to #{path.inspect}") true end |