Sha256: 4ac1b30e256d057f0f395a86e9033f7205448f89ff05a8bf61e27dadc89b4689

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

module Voltage
  def self.call
    Extensions::Call
  end

  module Extensions
    module Call
      def self.included(target)
        target.include(Voltage)
        target.extend(ClassMethods)
      end

      module ClassMethods
        def call(*args, **kwargs)
          new(*args, **kwargs).tap do |instance|
            yield(instance) if block_given?
            instance.call
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltage-0.1.0 lib/voltage/extensions/call.rb