Sha256: 8a880160dbc94739a56f9d6ee59239a52ed0073c4480d99ac59f34e107c99197
Contents?: true
Size: 1.1 KB
Versions: 49
Compression:
Stored size: 1.1 KB
Contents
module Cmor module Core module Frontend module Generators class ServiceControllerGenerator < Rails::Generators::Base desc 'Generates a service controller.' source_root File.expand_path('../templates', __FILE__) class_option :controller_class, type: 'string', aliases: '-c' class_option :service_class, type: 'string', aliases: '-s' def generate_controller template 'service_controller.rb', target_filename end private def current_engine @current_engine ||= File.open("config/routes.rb", &:readline).split('.').first end def target_filename "app/controllers/#{controller_class.underscore}.rb" end def controller_class @controller_class ||= options[:controller_class] end def service_class controller_class.gsub('Controller').singularize.append('Service') end def params_name service_class.demodulize.underscore end end end end end end
Version data entries
49 entries across 49 versions & 1 rubygems