Sha256: da5885e27c1bdb46dcd5304d56579a651ccc7135a783d18918d8079bcdde4ca8

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Muina
  # Simple Service Object compatible with MiniService::Base
  class Service
    include T::Props
    include T::Props::Constructor
    include PrivateCreation

    def self.call(hash = {})
      new(hash).__send__(:perform)
    end
    class << self; alias_method :[], :call; end

    def self.arguments(*args, **opts)
      args.each { |arg| const arg, T.untyped }
      opts.each { |key, value| const key, T.untyped, default: value }
    end

    def perform
      raise NotImplementedError, "Please implement the #{self.class}#perform method"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muina-0.2.8 lib/muina/service.rb