Sha256: d82b178e31f7c31aed09723cff4cdbe70771ae96833df5a5b8dad05c9e857759

Contents?: true

Size: 659 Bytes

Versions: 13

Compression:

Stored size: 659 Bytes

Contents

require_relative '../setup/setup_generator.rb'

module Service
  module Generators
    class UsecaseGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('templates', __dir__)

      argument :usecases, type: :array, default: [], banner: 'usecase usecase'

      def call
        invoke Service::Generators::SetupGenerator, [name]

        usecases.each do |u|
          @usecase = u.classify
          path = "app/services/#{service_name}/usecases/#{u.underscore}.rb"
          template 'usecase.rb.erb', path
        end
      end

      private

      def service_name
        "#{name.underscore}_service"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
command_service_object-0.6.5 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.6.4 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.6.3 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.6.2 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.6.1 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.6.0 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.11 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.10 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.9 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.8 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.7 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.6 lib/generators/service/usecase/usecase_generator.rb
command_service_object-0.5.5 lib/generators/service/usecase/usecase_generator.rb