class DeviseJwtMehak::ServiceGenerator

Public Instance Methods

create_service_file() click to toggle source
# File lib/generators/devise_jwt_mehak/service/service_generator.rb, line 9
def create_service_file
  @module_name = options[:module]

  service_dir_path = "app/services"
  generator_dir_path = service_dir_path + ("/#{@module_name.underscore}" if @module_name.present?).to_s
  generator_path = generator_dir_path + "/#{file_name}.rb"

  Dir.mkdir(service_dir_path) unless File.exist?(service_dir_path)
  Dir.mkdir(generator_dir_path) unless File.exist?(generator_dir_path)

  template "service.erb", generator_path
end