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.



58
59
60
61
# File 'lib/ruby-processing/exporters/creator.rb', line 58

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

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

Instance Method Details

#save(template) ⇒ Object



63
64
65
66
67
# File 'lib/ruby-processing/exporters/creator.rb', line 63

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