Class: AssetTrip::FileWriter
- Inherits:
-
Object
- Object
- AssetTrip::FileWriter
- Defined in:
- lib/asset_trip/file_writer.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ FileWriter
constructor
A new instance of FileWriter.
- #write!(contents) ⇒ Object
Constructor Details
#initialize(path) ⇒ FileWriter
Returns a new instance of FileWriter.
4 5 6 |
# File 'lib/asset_trip/file_writer.rb', line 4 def initialize(path) @path = path end |
Instance Method Details
#write!(contents) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/asset_trip/file_writer.rb', line 8 def write!(contents) FileUtils.mkdir_p(File.dirname(@path)) File.open(@path, "w") do |file| file << contents end end |