Class: Processing::Inner

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

Overview

This class creates a pseudo ‘java inner class’ of the sketch

Constant Summary

Constants inherited from Creator

Creator::ALL_DIGITS

Instance Method Summary collapse

Methods inherited from Creator

#already_exist, #usage

Instance Method Details

#create!(path, _args_) ⇒ Object

Create a pseudo inner class, given a path.



154
155
156
157
158
159
160
161
162
163
# File 'lib/ruby-processing/exporters/creator.rb', line 154

def create!(path, _args_)
  return usage if /\?/ =~ path || /--help/ =~ path
  main_file = File.basename(path, '.rb') # allow uneeded extension input
  # Check to make sure that the main file doesn't exist already
  already_exist(path)
  @name = main_file.camelize
  writer = SketchWriter.new(main_file)
  template = inner_class_template
  writer.save(template)
end

#inner_class_templateObject



150
151
152
# File 'lib/ruby-processing/exporters/creator.rb', line 150

def inner_class_template
  format(INNER, @name)
end