Class: Mayu::Resources::Generators::WriteFile
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/resources/generators/write_file.rb
Instance Method Summary collapse
-
#initialize(contents:, compress:) ⇒ WriteFile
constructor
A new instance of WriteFile.
- #process(target_path) ⇒ Object
Constructor Details
#initialize(contents:, compress:) ⇒ WriteFile
Returns a new instance of WriteFile.
14 15 16 17 |
# File 'lib/mayu/resources/generators/write_file.rb', line 14 def initialize(contents:, compress:) @contents = contents @compress = compress end |
Instance Method Details
#process(target_path) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mayu/resources/generators/write_file.rb', line 20 def process(target_path) write_file(target_path, @contents) if @compress write_file(target_path + ".br", Brotli.deflate(@contents)) end end |