module PowerTypes::Command

Public Class Methods

for(kwargs = {}) click to toggle source
# File lib/power_types/patterns/command.rb, line 6
def self.for(kwargs = {})
  new(kwargs).perform
end
new(*_attributes) click to toggle source
# 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

Public Instance Methods

perform() click to toggle source
# File lib/power_types/patterns/command.rb, line 10
def perform
  raise NotImplementedError, "Command must implement `perform`"
end