Sha256: 62600e20436c00ae2c62bc4a7b423b837906ff4f82d37c4da110ce15b463fd2d

Contents?: true

Size: 374 Bytes

Versions: 10

Compression:

Stored size: 374 Bytes

Contents

module PowerTypes
  module Command
    def self.new(*_attributes)
      Service.new(*_attributes).tap do |klass|
        klass.class_eval do
          def self.for(kwargs = {})
            new(kwargs).perform
          end

          def perform
            raise NotImplementedError, "Command must implement `perform`"
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
power-types-0.7.0 lib/power_types/patterns/command.rb
power-types-0.6.0 lib/power_types/patterns/command.rb
power-types-0.5.0 lib/power_types/patterns/command.rb
power-types-0.4.0 lib/power_types/patterns/command.rb
power-types-0.3.1 lib/power_types/patterns/command.rb
power-types-0.3.0 lib/power_types/patterns/command.rb
power-types-0.2.0 lib/power_types/patterns/command.rb
power-types-0.1.2 lib/power_types/patterns/command.rb
power-types-0.1.0 lib/power_types/patterns/command.rb
power-types-0.0.1 lib/power_types/patterns/command.rb