lib/jets/klass.rb in jets-2.1.7 vs lib/jets/klass.rb in jets-2.2.0

- old
+ new

@@ -43,18 +43,18 @@ else path.sub(%r{.*app/(.*?)/},'').sub(/\.rb$/,'').camelize end end + APP_TYPES = %w[controller job rule authorizer] def from_task(task) class_name = task.class_name filename = class_name.underscore - # Examples of filename: posts_controller, hard_job, security_rule, + # Examples of filename: posts_controller, hard_job, security_rule, main_authorizer # hello_function, hello - valid_types = %w[controller job rule] type = filename.split('_').last - type = "function" unless valid_types.include?(type) + type = "function" unless APP_TYPES.include?(type) path = "app/#{type.pluralize}/#{filename}.rb" from_path(path) end