Class: Processing::SketchWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-processing/exporters/creator.rb

Overview

Write file to disk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ SketchWriter

Returns a new instance of SketchWriter.



56
57
58
# File 'lib/ruby-processing/exporters/creator.rb', line 56

def initialize(path)
  @file = "#{File.dirname(path)}/#{path.underscore}.rb"
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



55
56
57
# File 'lib/ruby-processing/exporters/creator.rb', line 55

def file
  @file
end

Instance Method Details

#save(template) ⇒ Object



60
61
62
63
64
# File 'lib/ruby-processing/exporters/creator.rb', line 60

def save(template)
  File.open(file, 'w+') do |f|
    f.write(template)
  end
end