Sha256: 6ecc3bbc2ce88e315b18c7c71123eef89fe66bb3e5e787d656369654892533ef

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module OnStrum
  module Service
    module ClassMethods
      def call(*args, **kwargs, &block)
        # For Ruby 2.7: call({key: 'value'}) -> args=[], kwargs={key: 'value'}
        # For Ruby 3.0: call({key: 'value'}) -> args=[{key: 'value'}], kwargs={}
        ctx = ::RUBY_VERSION < '3.0' && args.empty? ? kwargs : args.first
        new(ctx || {}, **kwargs).execute(&block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
on_strum-service-1.1.1 lib/on_strum/service/class_methods.rb
on_strum-service-1.1.0 lib/on_strum/service/class_methods.rb