2
2
3
3
BASIC = <<-CODE
4
4
def setup
5
- sketch_title '%s'
5
+ sketch_title '%s'
6
6
end
7
7
8
8
def draw
9
9
10
10
end
11
11
12
12
def settings
13
- size %s, %s
14
- # pixel_density(2) # here for hi-dpi displays only
15
- # smooth # here
13
+ size %s, %s
14
+ # pixel_density(2) # here for hi-dpi displays only
15
+ # smooth # here
16
16
end
17
17
18
18
CODE
19
19
20
20
BASIC_MODE = <<-CODE
21
21
def setup
22
- sketch_title '%s'
22
+ sketch_title '%s'
23
23
end
24
24
25
25
def draw
26
26
27
27
end
28
28
29
29
def settings
30
- size %s, %s, %s
31
- # smooth # here
30
+ size %s, %s, %s
31
+ # smooth # here
32
32
end
33
33
34
34
CODE
@@ -37,19 +37,19 @@ def settings
37
37
# encoding: utf-8
38
38
# frozen_string_literal: false
39
39
class %s < Processing::App
40
- def setup
41
- sketch_title '%s'
42
- end
40
+ def setup
41
+ sketch_title '%s'
42
+ end
43
43
44
- def draw
44
+ def draw
45
45
46
- end
46
+ end
47
47
48
- def settings
49
- size %s, %s
50
- # pixel_density(2) # here for hi-dpi displays only
51
- # smooth # here
52
- end
48
+ def settings
49
+ size %s, %s
50
+ # pixel_density(2) # here for hi-dpi displays only
51
+ # smooth # here
52
+ end
53
53
end
54
54
CODE
55
55
@@ -59,21 +59,21 @@ def settings
59
59
require 'jruby_art'
60
60
require 'jruby_art/app'
61
61
62
- Processing::App::SKETCH_PATH = __FILE__
62
+ Processing::App::SKETCH_PATH = __FILE__.freeze
63
63
64
64
class %s < Processing::App
65
- def setup
66
- sketch_title '%s'
67
- end
65
+ def setup
66
+ sketch_title '%s'
67
+ end
68
68
69
- def draw
69
+ def draw
70
70
71
- end
71
+ end
72
72
73
- def settings
74
- size %s, %s
75
- # smooth # here
76
- end
73
+ def settings
74
+ size %s, %s
75
+ # smooth # here
76
+ end
77
77
end
78
78
79
79
%s.new unless defined? $app
@@ -83,18 +83,18 @@ def settings
83
83
# encoding: utf-8
84
84
# frozen_string_literal: false
85
85
class %s < Processing::App
86
- def setup
87
- sketch_title '%s'
88
- end
86
+ def setup
87
+ sketch_title '%s'
88
+ end
89
89
90
- def draw
90
+ def draw
91
91
92
- end
92
+ end
93
93
94
- def settings
95
- size %s, %s, %s
96
- # smooth # here
97
- end
94
+ def settings
95
+ size %s, %s, %s
96
+ # smooth # here
97
+ end
98
98
end
99
99
CODE
100
100
@@ -104,21 +104,21 @@ def settings
104
104
require 'jruby_art'
105
105
require 'jruby_art/app'
106
106
107
- Processing::App::SKETCH_PATH = __FILE__
107
+ Processing::App::SKETCH_PATH = __FILE__.freeze
108
108
109
109
class %s < Processing::App
110
- def setup
111
- sketch_title '%s'
112
- end
110
+ def setup
111
+ sketch_title '%s'
112
+ end
113
113
114
- def draw
114
+ def draw
115
115
116
- end
116
+ end
117
117
118
- def settings
119
- size %s, %s, %s
120
- # smooth # here
121
- end
118
+ def settings
119
+ size %s, %s, %s
120
+ # smooth # here
121
+ end
122
122
end
123
123
124
124
%s.new unless defined? $app
@@ -128,21 +128,20 @@ def settings
128
128
# encoding: utf-8
129
129
# frozen_string_literal: false
130
130
class %s
131
- include Processing::Proxy
131
+ include Processing::Proxy
132
132
133
133
end
134
134
CODE
135
135
136
136
# creator wrapper module using StringExtra
137
137
module Creator
138
138
require_relative '../helpers/string_extra'
139
- using StringExtra
140
139
# Write file to disk
141
140
class SketchWriter
142
141
attr_reader :file
143
142
144
143
def initialize ( path )
145
- underscore = path . underscore
144
+ underscore = StringExtra . new ( path ) . underscore
146
145
@file = "#{ File . dirname ( path ) } /#{ underscore } .rb"
147
146
end
148
147
@@ -157,7 +156,7 @@ def save(template)
157
156
class Base
158
157
ALL_DIGITS = /\A \d +\Z /
159
158
def already_exist ( path )
160
- underscore = path . underscore
159
+ underscore = StringExtra . new ( path ) . underscore
161
160
new_file = "#{ File . dirname ( path ) } /#{ underscore } .rb"
162
161
return if !FileTest . exist? ( path ) && !FileTest . exist? ( new_file )
163
162
puts 'That file already exists!'
@@ -197,7 +196,7 @@ def create!(path, args)
197
196
already_exist ( path )
198
197
main_file = File . basename ( path , '.rb' ) # allow uneeded extension input
199
198
writer = SketchWriter . new ( main_file )
200
- @title = main_file . titleize
199
+ @title = StringExtra . new ( main_file ) . titleize
201
200
@width = args [ 0 ]
202
201
@height = args [ 1 ]
203
202
@mode = args [ 2 ] . upcase unless args [ 2 ] . nil?
@@ -222,9 +221,9 @@ def create!(path, args)
222
221
main_file = File . basename ( path , '.rb' ) # allow uneeded extension input
223
222
# Check to make sure that the main file doesn't exist already
224
223
already_exist ( path )
225
- @name = main_file . camelize
224
+ @name = StringExtra . new ( main_file ) . camelize
226
225
writer = SketchWriter . new ( main_file )
227
- @title = main_file . titleize
226
+ @title = StringExtra . new ( main_file ) . titleize
228
227
@width , @height = args [ 0 ] , args [ 1 ]
229
228
@mode = args [ 2 ] . upcase unless args [ 2 ] . nil?
230
229
template = @mode . nil? ? class_template : class_template_mode
@@ -247,9 +246,9 @@ def create!(path, args)
247
246
main_file = File . basename ( path , '.rb' ) # allow uneeded extension input
248
247
# Check to make sure that the main file doesn't exist already
249
248
already_exist ( path )
250
- @name = main_file . camelize
249
+ @name = StringExtra . new ( main_file ) . camelize
251
250
writer = SketchWriter . new ( main_file )
252
- @title = main_file . titleize
251
+ @title = StringExtra . new ( main_file ) . titleize
253
252
@width , @height = args [ 0 ] , args [ 1 ]
254
253
@mode = args [ 2 ] . upcase unless args [ 2 ] . nil?
255
254
template = @mode . nil? ? emacs_template : emacs_template_mode
0 commit comments