class SketchWriter

The file writer can write a sketch when given instance of Sketch type

Attributes

file[R]
param[R]

Public Class Methods

new(path, args) click to toggle source
# File lib/jruby_art/creators/sketch_writer.rb, line 37
def initialize(path, args)
  @param = SketchParameters.new(name: path, args: args)
  @file = format(
    '%<dir>s/%<file>s.rb', dir: File.dirname(path), file: path
  )
end

Public Instance Methods

write() click to toggle source
# File lib/jruby_art/creators/sketch_writer.rb, line 44
def write
  sketch = SketchFactory.create(param)
  File.open(file, 'w+') { |f| f.write sketch.join("\n") }
end