Sha256: 99de3b4d0434f25f926b4e1aa751825685c1f418fb59ed5d0993f91c4b7a22a0
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true module ServiceIt # Inherit this class and implement perform method # # Documentation: # https://github.com/iago-silva/service_it class Base class << self # Call your service # # Example: # Foo.call(arg1: 1, arg2: 2) # # Arguments: # args: (Hash) # # Return: # perform's return def call(**args) new_instance(args).perform end private def new_instance(args) instance = new args.each do |key, value| instance.instance_variable_set("@#{key}", value) end instance end end # Implement this method to run your service def perform raise NotImplementedError, "Please implement 'perform' method in your #{self.class.name}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
service_it-1.0.0 | lib/service_it/base.rb |