Sha256: 3a87f4f7def87c4b6180a0e7d67546f150b8986f71960062add2aeb55e413af7

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

require_relative '../setup/setup_generator.rb'

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

      source_root File.expand_path('templates', __dir__)

      argument :setters, type: :array, default: [], banner: 'setters setters'

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

      def create_setters
        setters.each do |s|
          @setter = s.classify

          path = "app/services/#{service_name}/usecases/setters/#{s.underscore}.rb"
          template 'setter.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/setter/setter_generator.rb