Module: PowerTypes::Command

Defined in:
lib/power_types/patterns/command.rb

Class Method Summary collapse

Class Method Details

.new(*_attributes) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/power_types/patterns/command.rb', line 3

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