Class: Aardi::FileTarget
- Inherits:
-
Object
- Object
- Aardi::FileTarget
- Defined in:
- lib/aardi/file_target.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(src, target_path) ⇒ FileTarget
constructor
A new instance of FileTarget.
-
#write ⇒ Object
:reek:TooManyStatements.
Constructor Details
#initialize(src, target_path) ⇒ FileTarget
Returns a new instance of FileTarget.
5 6 7 8 9 10 11 |
# File 'lib/aardi/file_target.rb', line 5 def initialize(src, target_path) renderer = Aardi.renderer @src = src @path = target_path @content_hashes = renderer.content_hashes @html_files = renderer.html_files end |
Instance Method Details
#write ⇒ Object
:reek:TooManyStatements
14 15 16 17 18 19 20 21 22 |
# File 'lib/aardi/file_target.rb', line 14 def write hash = @src.output_hash return { @path => hash } unless should_write? FileUtils.mkdir_p(File.dirname(@path)) File.write(@path, "#{@src.output}\n") puts("Wrote #{@path}") { @path => hash } end |