Class: Propane::Inner

Inherits:
Creator show all
Defined in:
lib/propane/creators/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.



125
126
127
128
129
130
131
132
133
134
# File 'lib/propane/creators/creator.rb', line 125

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



121
122
123
# File 'lib/propane/creators/creator.rb', line 121

def inner_class_template
  format(INNER, @name)
end