plezi 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,271 +1,270 @@
1
1
  module Plezi
2
- #####
3
- # this class holds the route and matching logic that will normally be used for HTTP handling
4
- # it is used internally and documentation is present for development and edge users.
5
- class Route
6
- # the Regexp that will be used to match the request.
7
- attr_reader :path
8
- # the controller that answers the request on this path (if exists).
9
- attr_reader :controller
10
- # the proc that answers the request on this path (if exists).
11
- attr_reader :proc
12
- # the parameters for the router and service that were used to create the service, router and host.
13
- attr_reader :params
2
+ module Base
3
+ class Route
4
+ # the Regexp that will be used to match the request.
5
+ attr_reader :path
6
+ # the controller that answers the request on this path (if exists).
7
+ attr_reader :controller
8
+ # the proc that answers the request on this path (if exists).
9
+ attr_reader :proc
10
+ # the parameters for the router and service that were used to create the service, router and host.
11
+ attr_reader :params
14
12
 
15
- # lets the route answer the request. returns false if no response has been sent.
16
- def on_request request, response
17
- fill_parameters = match request.path
18
- return false unless fill_parameters
19
- old_params = request.params.dup
20
- fill_parameters.each {|k,v| Plezi::Base::Helpers.add_param_to_hash k, v, request.params }
21
- ret = false
22
- if controller
23
- ret = controller.new(request, response)._route_path_to_methods_and_set_the_response_
24
- elsif proc
25
- ret = proc.call(request, response)
26
- elsif controller == false
27
- request.path = path.match(request.path).to_a.last.to_s
28
- return false
29
- end
30
- unless ret
31
- request.params.replace old_params unless fill_parameters.empty?
32
- return false
13
+ # lets the route answer the request. returns false if no response has been sent.
14
+ def on_request request, response
15
+ fill_parameters = match request.path
16
+ return false unless fill_parameters
17
+ old_params = request.params.dup
18
+ fill_parameters.each {|k,v| Plezi::Base::Helpers.add_param_to_hash k, v, request.params }
19
+ ret = false
20
+ if controller
21
+ ret = controller.new(request, response)._route_path_to_methods_and_set_the_response_
22
+ elsif proc
23
+ ret = proc.call(request, response)
24
+ elsif controller == false
25
+ request.path = path.match(request.path).to_a.last.to_s
26
+ return false
27
+ end
28
+ unless ret
29
+ request.params.replace old_params unless fill_parameters.empty?
30
+ return false
31
+ end
32
+ return ret
33
33
  end
34
- return ret
35
- end
36
34
 
37
- # the initialize method accepts a Regexp or a String and creates the path object.
38
- #
39
- # Regexp paths will be left unchanged
40
- #
41
- # a string can be either a simple string `"/users"` or a string with parameters:
42
- # `"/static/:required/(:optional)/(:optional_with_format){[\d]*}/:optional_2"`
43
- def initialize path, controller, params={}, &block
44
- @original_path, @url_array, @params = path, false, params
45
- initialize_path path
46
- initialize_controller controller, block
47
- end
35
+ # the initialize method accepts a Regexp or a String and creates the path object.
36
+ #
37
+ # Regexp paths will be left unchanged
38
+ #
39
+ # a string can be either a simple string `"/users"` or a string with parameters:
40
+ # `"/static/:required/(:optional)/(:optional_with_format){[\d]*}/:optional_2"`
41
+ def initialize path, controller, params={}, &block
42
+ @original_path, @url_array, @params = path, false, params
43
+ initialize_path( (controller == false) ? "#{path.chomp('/')}/*" : path )
44
+ initialize_controller controller, block
45
+ end
48
46
 
49
- # initializes the controller,
50
- # by inheriting the class into an Plezi controller subclass (with the Plezi::ControllerMagic injected).
51
- #
52
- # Proc objects are currently passed through without any change - as Proc routes are assumed to handle themselves correctly.
53
- def initialize_controller controller, block
54
- @controller, @proc = controller, block
55
- if controller.is_a?(Class)
56
- # add controller magic
57
- @controller = self.class.make_controller_magic controller, self
47
+ # initializes the controller,
48
+ # by inheriting the class into an Plezi controller subclass (with the Plezi::ControllerMagic injected).
49
+ #
50
+ # Proc objects are currently passed through without any change - as Proc routes are assumed to handle themselves correctly.
51
+ def initialize_controller controller, block
52
+ @controller, @proc = controller, block
53
+ if controller.is_a?(Class)
54
+ # add controller magic
55
+ @controller = self.class.make_controller_magic controller, self
56
+ end
58
57
  end
59
- end
60
58
 
61
- # # returns the url for THIS route (i.e. `url_for :index`)
62
- # #
63
- # # This will be usually used by the Controller's #url_for method to get the relative part of the url.
64
- # def url_for dest = :index
65
- # raise NotImplementedError, "#url_for isn't implemented for this router - could this be a Regexp based router?" unless @url_array
66
- # # convert dest.id and dest[:id] to their actual :id value.
67
- # dest = (dest.id rescue false) || (raise TypeError, "Expecting a Symbol, Hash, String, Numeric or an object that answers to obj[:id] or obj.id") unless !dest || dest.is_a?(Symbol) || dest.is_a?(String) || dest.is_a?(Numeric) || dest.is_a?(Hash)
68
- # url = '/'
69
- # case dest
70
- # when false, nil, '', :index
71
- # add = true
72
- # @url_array.each do |sec|
73
- # add = false unless sec[0] != :path
74
- # url << sec[1] if add
75
- # raise NotImplementedError, '#url_for(index) cannot be implementedfor this path.' if !add && sec[0] == :path
76
- # # todo: :multi_path
77
- # end
78
- # when Hash
79
- # when Symbol, String, Numeric
80
- # end
81
- # end
59
+ # # returns the url for THIS route (i.e. `url_for :index`)
60
+ # #
61
+ # # This will be usually used by the Controller's #url_for method to get the relative part of the url.
62
+ # def url_for dest = :index
63
+ # raise NotImplementedError, "#url_for isn't implemented for this router - could this be a Regexp based router?" unless @url_array
64
+ # # convert dest.id and dest[:id] to their actual :id value.
65
+ # dest = (dest.id rescue false) || (raise TypeError, "Expecting a Symbol, Hash, String, Numeric or an object that answers to obj[:id] or obj.id") unless !dest || dest.is_a?(Symbol) || dest.is_a?(String) || dest.is_a?(Numeric) || dest.is_a?(Hash)
66
+ # url = '/'
67
+ # case dest
68
+ # when false, nil, '', :index
69
+ # add = true
70
+ # @url_array.each do |sec|
71
+ # add = false unless sec[0] != :path
72
+ # url << sec[1] if add
73
+ # raise NotImplementedError, '#url_for(index) cannot be implementedfor this path.' if !add && sec[0] == :path
74
+ # # todo: :multi_path
75
+ # end
76
+ # when Hash
77
+ # when Symbol, String, Numeric
78
+ # end
79
+ # end
82
80
 
83
81
 
84
82
 
85
- # returns the url for THIS route (i.e. `url_for :index`)
86
- #
87
- # This will be usually used by the Controller's #url_for method to get the relative part of the url.
88
- def url_for dest = :index
89
- raise NotImplementedError, "#url_for isn't implemented for this router - could this be a Regexp based router?" unless @url_array
90
- case dest
91
- when String
92
- dest = {id: dest.dup}
93
- when Numeric, Symbol
94
- dest = {id: dest}
95
- when Hash
96
- dest = dest.dup
97
- dest.each {|k,v| dest[k] = v.dup if v.is_a? String }
98
- when nil, false
99
- dest = {}
100
- else
101
- # convert dest.id and dest[:id] to their actual :id value.
102
- dest = {id: (dest.id rescue false) || (raise TypeError, "Expecting a Symbol, Hash, String, Numeric or an object that answers to obj[:id] or obj.id") }
103
- end
104
- dest.default_proc = Plezi::Base::Helpers::HASH_SYM_PROC
83
+ # returns the url for THIS route (i.e. `url_for :index`)
84
+ #
85
+ # This will be usually used by the Controller's #url_for method to get the relative part of the url.
86
+ def url_for dest = :index
87
+ raise NotImplementedError, "#url_for isn't implemented for this router - could this be a Regexp based router?" unless @url_array
88
+ case dest
89
+ when String
90
+ dest = {id: dest.dup}
91
+ when Numeric, Symbol
92
+ dest = {id: dest}
93
+ when Hash
94
+ dest = dest.dup
95
+ dest.each {|k,v| dest[k] = v.dup if v.is_a? String }
96
+ when nil, false
97
+ dest = {}
98
+ else
99
+ # convert dest.id and dest[:id] to their actual :id value.
100
+ dest = {id: (dest.id rescue false) || (raise TypeError, "Expecting a Symbol, Hash, String, Numeric or an object that answers to obj[:id] or obj.id") }
101
+ end
102
+ dest.default_proc = Plezi::Base::Helpers::HASH_SYM_PROC
105
103
 
106
- url = '/'
104
+ url = '/'
107
105
 
108
- @url_array.each do |sec|
109
- raise NotImplementedError, "#url_for isn't implemented for this router - Regexp multi-path routes are still being worked on... use a named parameter instead (i.e. '/foo/(:multi_route){route1|route2}/bar')" if REGEXP_FORMATTED_PATH === sec
106
+ @url_array.each do |sec|
107
+ raise NotImplementedError, "#url_for isn't implemented for this router - Regexp multi-path routes are still being worked on... use a named parameter instead (i.e. '/foo/(:multi_route){route1|route2}/bar')" if REGEXP_FORMATTED_PATH === sec
110
108
 
111
- param_name = (REGEXP_OPTIONAL_PARAMS.match(sec) || REGEXP_FORMATTED_OPTIONAL_PARAMS.match(sec) || REGEXP_REQUIRED_PARAMS.match(sec) || REGEXP_FORMATTED_REQUIRED_PARAMS.match(sec))
112
- param_name = param_name[1].to_sym if param_name
109
+ param_name = (REGEXP_OPTIONAL_PARAMS.match(sec) || REGEXP_FORMATTED_OPTIONAL_PARAMS.match(sec) || REGEXP_REQUIRED_PARAMS.match(sec) || REGEXP_FORMATTED_REQUIRED_PARAMS.match(sec))
110
+ param_name = param_name[1].to_sym if param_name
113
111
 
114
- if param_name && dest[param_name]
115
- url << Plezi::Base::Helpers.encode_url(dest.delete(param_name))
116
- url << '/'
117
- elsif !param_name
118
- url << sec
119
- url << '/'
120
- elsif REGEXP_REQUIRED_PARAMS === sec || REGEXP_OPTIONAL_PARAMS === sec
121
- url << '/'
122
- elsif REGEXP_FORMATTED_REQUIRED_PARAMS === sec
123
- raise ArgumentError, "URL can't be formatted becuse a required parameter (#{param_name.to_s}) isn't specified and it requires a special format (#{REGEXP_FORMATTED_REQUIRED_PARAMS.match(sec)[2]})."
112
+ if param_name && dest[param_name]
113
+ url << Plezi::Base::Helpers.encode_url(dest.delete(param_name))
114
+ url << '/'
115
+ elsif !param_name
116
+ url << sec
117
+ url << '/'
118
+ elsif REGEXP_REQUIRED_PARAMS === sec || REGEXP_OPTIONAL_PARAMS === sec
119
+ url << '/'
120
+ elsif REGEXP_FORMATTED_REQUIRED_PARAMS === sec
121
+ raise ArgumentError, "URL can't be formatted becuse a required parameter (#{param_name.to_s}) isn't specified and it requires a special format (#{REGEXP_FORMATTED_REQUIRED_PARAMS.match(sec)[2]})."
122
+ end
124
123
  end
125
- end
126
- unless dest.empty?
127
- add = '?'
128
- dest.each {|k, v| url << "#{add}#{Plezi::Base::Helpers.encode_url k}=#{Plezi::Base::Helpers.encode_url v}"; add = '&'}
129
- end
130
- url
124
+ unless dest.empty?
125
+ add = '?'
126
+ dest.each {|k, v| url << "#{add}#{Plezi::Base::Helpers.encode_url k}=#{Plezi::Base::Helpers.encode_url v}"; add = '&'}
127
+ end
128
+ url
131
129
 
132
- end
130
+ end
133
131
 
134
132
 
135
- # Used to check for routes formatted: /:paramater - required parameters
136
- REGEXP_REQUIRED_PARAMS = /^\:([^\(\)\{\}\:]*)$/
137
- # Used to check for routes formatted: /(:paramater) - optional parameters
138
- REGEXP_OPTIONAL_PARAMS = /^\(\:([^\(\)\{\}\:]*)\)$/
139
- # Used to check for routes formatted: /(:paramater){regexp} - optional formatted parameters
140
- REGEXP_FORMATTED_OPTIONAL_PARAMS = /^\(\:([^\(\)\{\}\:]*)\)\{(.*)\}$/
141
- # Used to check for routes formatted: /:paramater{regexp} - required parameters
142
- REGEXP_FORMATTED_REQUIRED_PARAMS = /^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/
143
- # Used to check for routes formatted: /{regexp} - required path
144
- REGEXP_FORMATTED_PATH = /^\{(.*)\}$/
133
+ # Used to check for routes formatted: /:paramater - required parameters
134
+ REGEXP_REQUIRED_PARAMS = /^\:([^\(\)\{\}\:]*)$/
135
+ # Used to check for routes formatted: /(:paramater) - optional parameters
136
+ REGEXP_OPTIONAL_PARAMS = /^\(\:([^\(\)\{\}\:]*)\)$/
137
+ # Used to check for routes formatted: /(:paramater){regexp} - optional formatted parameters
138
+ REGEXP_FORMATTED_OPTIONAL_PARAMS = /^\(\:([^\(\)\{\}\:]*)\)\{(.*)\}$/
139
+ # Used to check for routes formatted: /:paramater{regexp} - required parameters
140
+ REGEXP_FORMATTED_REQUIRED_PARAMS = /^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/
141
+ # Used to check for routes formatted: /{regexp} - required path
142
+ REGEXP_FORMATTED_PATH = /^\{(.*)\}$/
145
143
 
146
- # initializes the path by converting the string into a Regexp
147
- # and noting any parameters that might need to be extracted for RESTful routes.
148
- def initialize_path path
149
- @fill_parameters = {}
150
- if path.is_a? Regexp
151
- @path = path
152
- elsif path.is_a? String
153
- # prep used prameters
154
- param_num = 0
144
+ # initializes the path by converting the string into a Regexp
145
+ # and noting any parameters that might need to be extracted for RESTful routes.
146
+ def initialize_path path
147
+ @fill_parameters = {}
148
+ if path.is_a? Regexp
149
+ @path = path
150
+ elsif path.is_a? String
151
+ # prep used prameters
152
+ param_num = 0
155
153
 
156
- section_search = "([\\/][^\\/]*)"
157
- optional_section_search = "([\\/][^\\/]*)?"
154
+ section_search = "([\\/][^\\/]*)"
155
+ optional_section_search = "([\\/][^\\/]*)?"
158
156
 
159
- @path = '^'
160
- @url_array = []
157
+ @path = '^'
158
+ @url_array = []
161
159
 
162
- # prep path string and split it where the '/' charected is unescaped.
163
- @url_array = path.gsub(/(^\/)|(\/$)/, '').gsub(/([^\\])\//, '\1 - /').split ' - /'
164
- @url_array.each.with_index do |section, section_index|
165
- if section == '*'
166
- # create catch all
167
- section_index == 0 ? (@path << "(.*)") : (@path << "(\\/.*)?")
168
- # finish
169
- @path = /#{@path}$/
170
- return
160
+ # prep path string and split it where the '/' charected is unescaped.
161
+ @url_array = path.gsub(/(^\/)|(\/$)/, '').gsub(/([^\\])\//, '\1 - /').split ' - /'
162
+ @url_array.each.with_index do |section, section_index|
163
+ if section == '*'
164
+ # create catch all
165
+ section_index == 0 ? (@path << "(.*)") : (@path << "(\\/.*)?")
166
+ # finish
167
+ @path = /#{@path}$/
168
+ return
171
169
 
172
- # check for routes formatted: /:paramater - required parameters
173
- elsif section.match REGEXP_REQUIRED_PARAMS
174
- #create a simple section catcher
175
- @path << section_search
176
- # add paramater recognition value
177
- @fill_parameters[param_num += 1] = section.match(REGEXP_REQUIRED_PARAMS)[1]
170
+ # check for routes formatted: /:paramater - required parameters
171
+ elsif section.match REGEXP_REQUIRED_PARAMS
172
+ #create a simple section catcher
173
+ @path << section_search
174
+ # add paramater recognition value
175
+ @fill_parameters[param_num += 1] = section.match(REGEXP_REQUIRED_PARAMS)[1]
178
176
 
179
- # check for routes formatted: /(:paramater) - optional parameters
180
- elsif section.match REGEXP_OPTIONAL_PARAMS
181
- #create a optional section catcher
182
- @path << optional_section_search
183
- # add paramater recognition value
184
- @fill_parameters[param_num += 1] = section.match(REGEXP_OPTIONAL_PARAMS)[1]
177
+ # check for routes formatted: /(:paramater) - optional parameters
178
+ elsif section.match REGEXP_OPTIONAL_PARAMS
179
+ #create a optional section catcher
180
+ @path << optional_section_search
181
+ # add paramater recognition value
182
+ @fill_parameters[param_num += 1] = section.match(REGEXP_OPTIONAL_PARAMS)[1]
185
183
 
186
- # check for routes formatted: /(:paramater){regexp} - optional parameters
187
- elsif section.match REGEXP_FORMATTED_OPTIONAL_PARAMS
188
- #create a optional section catcher
189
- @path << ( "(\/(" + section.match(REGEXP_FORMATTED_OPTIONAL_PARAMS)[2] + "))?" )
190
- # add paramater recognition value
191
- @fill_parameters[param_num += 1] = section.match(REGEXP_FORMATTED_OPTIONAL_PARAMS)[1]
192
- param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
184
+ # check for routes formatted: /(:paramater){regexp} - optional parameters
185
+ elsif section.match REGEXP_FORMATTED_OPTIONAL_PARAMS
186
+ #create a optional section catcher
187
+ @path << ( "(\/(" + section.match(REGEXP_FORMATTED_OPTIONAL_PARAMS)[2] + "))?" )
188
+ # add paramater recognition value
189
+ @fill_parameters[param_num += 1] = section.match(REGEXP_FORMATTED_OPTIONAL_PARAMS)[1]
190
+ param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
193
191
 
194
- # check for routes formatted: /:paramater{regexp} - required parameters
195
- elsif section.match REGEXP_FORMATTED_REQUIRED_PARAMS
196
- #create a simple section catcher
197
- @path << ( "(\/(" + section.match(REGEXP_FORMATTED_REQUIRED_PARAMS)[2] + "))" )
198
- # add paramater recognition value
199
- @fill_parameters[param_num += 1] = section.match(REGEXP_FORMATTED_REQUIRED_PARAMS)[1]
200
- param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
192
+ # check for routes formatted: /:paramater{regexp} - required parameters
193
+ elsif section.match REGEXP_FORMATTED_REQUIRED_PARAMS
194
+ #create a simple section catcher
195
+ @path << ( "(\/(" + section.match(REGEXP_FORMATTED_REQUIRED_PARAMS)[2] + "))" )
196
+ # add paramater recognition value
197
+ @fill_parameters[param_num += 1] = section.match(REGEXP_FORMATTED_REQUIRED_PARAMS)[1]
198
+ param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
201
199
 
202
- # check for routes formatted: /{regexp} - formated path
203
- elsif section.match REGEXP_FORMATTED_PATH
204
- #create a simple section catcher
205
- @path << ( "\/(" + section.match(REGEXP_FORMATTED_PATH)[1] + ")" )
206
- # add paramater recognition value
207
- param_num += 1 # we are using one space - param_num += should look for () in regex ? /[^\\](/
208
- else
209
- @path << "\/"
210
- @path << section
200
+ # check for routes formatted: /{regexp} - formated path
201
+ elsif section.match REGEXP_FORMATTED_PATH
202
+ #create a simple section catcher
203
+ @path << ( "\/(" + section.match(REGEXP_FORMATTED_PATH)[1] + ")" )
204
+ # add paramater recognition value
205
+ param_num += 1 # we are using one space - param_num += should look for () in regex ? /[^\\](/
206
+ else
207
+ @path << "\/"
208
+ @path << section
209
+ end
211
210
  end
212
- end
213
- unless @fill_parameters.values.include?("id")
214
- @path << optional_section_search
215
- @fill_parameters[param_num += 1] = "id"
216
- @url_array << '(:id)'
217
- end
218
- # set the Regexp and return the final result.
219
- @path = /#{@path}$/
220
- else
221
- raise "Path cannot be initialized - path must be either a string or a regular experssion."
222
- end
223
- return
224
- end
211
+ unless @fill_parameters.values.include?("id")
212
+ @path << optional_section_search
213
+ @fill_parameters[param_num += 1] = "id"
214
+ @url_array << '(:id)'
215
+ end
216
+ # set the Regexp and return the final result.
217
+ @path = /#{@path}$/
218
+ else
219
+ raise "Path cannot be initialized - path must be either a string or a regular experssion."
220
+ end
221
+ return
222
+ end
225
223
 
226
- # this performs the match and assigns the parameters, if required.
227
- def match path
228
- hash = {}
229
- # m = nil
230
- # unless @fill_parameters.values.include?("format")
231
- # if (m = path.match /([^\.]*)\.([^\.\/]+)$/)
232
- # Plezi::Base::Helpers.add_param_to_hash 'format', m[2], hash
233
- # path = m[1]
234
- # end
235
- # end
236
- m = @path.match path
237
- return false unless m
238
- @fill_parameters.each { |k, v| hash[v] = m[k][1..-1] if m[k] && m[k] != '/' }
239
- hash
240
- end
224
+ # this performs the match and assigns the parameters, if required.
225
+ def match path
226
+ hash = {}
227
+ # m = nil
228
+ # unless @fill_parameters.values.include?("format")
229
+ # if (m = path.match /([^\.]*)\.([^\.\/]+)$/)
230
+ # Plezi::Base::Helpers.add_param_to_hash 'format', m[2], hash
231
+ # path = m[1]
232
+ # end
233
+ # end
234
+ m = @path.match path
235
+ return false unless m
236
+ @fill_parameters.each { |k, v| hash[v] = m[k][1..-1] if m[k] && m[k] != '/' }
237
+ hash
238
+ end
241
239
 
242
- ###########
243
- ## class magic methods
240
+ ###########
241
+ ## class magic methods
244
242
 
245
- protected
243
+ protected
246
244
 
247
- # injects some magic to the controller
248
- #
249
- # adds the `redirect_to` and `send_data` methods to the controller class, as well as the properties:
250
- # env:: the env recieved by the Rack server.
251
- # params:: the request's parameters.
252
- # cookies:: the request's cookies.
253
- # flash:: an amazing Hash object that sets temporary cookies for one request only - greate for saving data between redirect calls.
254
- #
255
- def self.make_controller_magic(controller, container)
256
- new_class_name = "Plezi__#{controller.name.gsub /[\:\-\#\<\>\{\}\(\)\s]/, '_'}"
257
- return Module.const_get new_class_name if Module.const_defined? new_class_name
258
- # controller.include Plezi::ControllerMagic
259
- controller.instance_exec(container) {|r| include Plezi::ControllerMagic; }
260
- ret = Class.new(controller) do
261
- include Plezi::Base::ControllerCore
245
+ # injects some magic to the controller
246
+ #
247
+ # adds the `redirect_to` and `send_data` methods to the controller class, as well as the properties:
248
+ # env:: the env recieved by the Rack server.
249
+ # params:: the request's parameters.
250
+ # cookies:: the request's cookies.
251
+ # flash:: an amazing Hash object that sets temporary cookies for one request only - greate for saving data between redirect calls.
252
+ #
253
+ def self.make_controller_magic(controller, container)
254
+ new_class_name = "Plezi__#{controller.name.gsub /[\:\-\#\<\>\{\}\(\)\s]/, '_'}"
255
+ return Module.const_get new_class_name if Module.const_defined? new_class_name
256
+ # controller.include Plezi::ControllerMagic
257
+ controller.instance_exec(container) {|r| include Plezi::ControllerMagic; }
258
+ ret = Class.new(controller) do
259
+ include Plezi::Base::ControllerCore
260
+ end
261
+ Object.const_set(new_class_name, ret)
262
+ Module.const_get(new_class_name).reset_routing_cache
263
+ ret.instance_exec(container) {|r| set_pl_route r;}
264
+ ret
262
265
  end
263
- Object.const_set(new_class_name, ret)
264
- Module.const_get(new_class_name).reset_routing_cache
265
- ret.instance_exec(container) {|r| set_pl_route r;}
266
- ret
267
- end
268
266
 
267
+ end
269
268
  end
270
269
 
271
270
  end