Class: EmacsSketch

Inherits:
Sketch show all
Defined in:
lib/jruby_art/creators/sketch_writer.rb

Overview

A sketch that will run with jruby, for emacs etc

Instance Attribute Summary

Attributes inherited from Sketch

#param

Instance Method Summary collapse

Methods inherited from Sketch

#class_methods, #initialize, #methods

Constructor Details

This class inherits a constructor from Sketch

Instance Method Details

#codeObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/jruby_art/creators/sketch_writer.rb', line 124

def code
  lines = [
    '# frozen_string_literal: true',
    BLANK,
    "require 'jruby_art'",
    "require 'jruby_art/app'",
    BLANK,
    'Processing::App::SKETCH_PATH = __FILE__.freeze',
    BLANK
  ]
  lines.concat class_methods
  lines << BLANK
  lines << format(
    '%<name>s.new if Processing.app.nil?', name: param.class_name
  )
end