Class: Propane::BasicSketch
- Defined in:
- lib/propane/creators/creator.rb
Overview
This class creates bare sketches, with an optional render mode
Constant Summary
Constants inherited from Creator
Instance Method Summary collapse
-
#create!(path, args) ⇒ Object
Create a class wrapped sketch, given a path.
- #template_default ⇒ Object
- #template_mode ⇒ Object
Methods inherited from Creator
Instance Method Details
#create!(path, args) ⇒ Object
Create a class wrapped sketch, given a path.
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/propane/creators/creator.rb', line 104 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 = StringExtra.new(main_file).camelize writer = SketchWriter.new(main_file) @title = StringExtra.new(main_file).titleize @width, @height = args[0], args[1] @mode = args[2].upcase unless args[2].nil? template = @mode.nil? ? template_default : template_mode writer.save(template) end |
#template_default ⇒ Object
96 97 98 |
# File 'lib/propane/creators/creator.rb', line 96 def template_default format(BASIC, @name, @width, @height, @name, @title) end |
#template_mode ⇒ Object
100 101 102 |
# File 'lib/propane/creators/creator.rb', line 100 def template_mode format(MODE, @name, @width, @height, @mode, @name, @title) end |