Module: ToProcInterface::PerformingService

Includes:
ToProcInterface
Defined in:
lib/to_proc_interface/performing_service.rb

Overview

Examples:

Usage

class Sum < Struct.new(:a, :b, keyword_init: true)
  extend ToProcInterface::PerformingService

  def perform
    self.a + self.b
  end
end

[
  { a: 1, b: 2 },
  { a: 3, b: 4 }
].map(&Sum) # => [3, 7]

Constant Summary

Constants included from ToProcInterface

METHODS, VERSION

Instance Attribute Summary

Attributes included from Mixin

#to_proc

Instance Method Summary collapse

Methods included from ToProcInterface

loader

Instance Method Details

#callObject

Initializes an object with the given args and invokes it’s #perform method without arguments.

See Also:

  • #initializer
  • #perform


23
24
25
# File 'lib/to_proc_interface/performing_service.rb', line 23

def call(...)
  new(...).perform
end