Class: Hyde::Page::GeneratedCssFile
- Inherits:
-
Jekyll::StaticFile
- Object
- Jekyll::StaticFile
- Hyde::Page::GeneratedCssFile
- Defined in:
- lib/hyde-page-css.rb
Instance Attribute Summary collapse
-
#file_contents ⇒ Object
Returns the value of attribute file_contents.
-
#generator ⇒ Object
readonly
Returns the value of attribute generator.
Instance Method Summary collapse
-
#initialize(site, dir, name) ⇒ GeneratedCssFile
constructor
A new instance of GeneratedCssFile.
- #write(dest) ⇒ Object
Constructor Details
#initialize(site, dir, name) ⇒ GeneratedCssFile
Returns a new instance of GeneratedCssFile.
22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde-page-css.rb', line 22 def initialize(site, dir, name) @site = site @dir = dir @name = name @relative_path = File.join(*[@dir, @name].compact) @extname = File.extname(@name) @type = @collection&.label&.to_sym @generator = "hyde-page-css" end |
Instance Attribute Details
#file_contents ⇒ Object
Returns the value of attribute file_contents.
19 20 21 |
# File 'lib/hyde-page-css.rb', line 19 def file_contents @file_contents end |
#generator ⇒ Object (readonly)
Returns the value of attribute generator.
20 21 22 |
# File 'lib/hyde-page-css.rb', line 20 def generator @generator end |
Instance Method Details
#write(dest) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/hyde-page-css.rb', line 32 def write(dest) dest_path = destination(dest) FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.rm(dest_path) if File.exist?(dest_path) File.open(dest_path, "w") do |output_file| output_file << file_contents end true end |