Sha256: dec131971d495ad819c639cb19cd6f7b9ea1d72c41ccde70edcd232bf70e79c5

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

require_relative '../setup/setup_generator.rb'

module Service
  module Generators
    class GetterGenerator < Rails::Generators::NamedBase
      # check_class_collision

      source_root File.expand_path('templates', __dir__)

      argument :getters, type: :array, default: [], banner: 'getter getter'

      def setup
        invoke Service::Generators::SetupGenerator, [name]
      end

      def create_getters
        getters.each do |g|
          @getter = g.classify

          path = "app/services/#{service_name}/usecases/getters/#{g.underscore}.rb"
          template 'getter.rb.erb', path
        end
      end

      private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
command_service_object-0.5.4 lib/generators/service/getter/getter_generator.rb