Sha256: 6056adbdd291a8ed053569b410d91dfcc712468e3176830e831c293db6772625

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require "much-rails/call_method"
require "much-rails/mixin"
require "much-rails/result"
require "much-rails/wrap_method"

module MuchRails; end

# MuchRails::WrapAndCallMethod is a mix-in to implement the `wrap_and_call`
# and `wrap_and_map_call` class/instance method pattern.
module MuchRails::WrapAndCallMethod
  include MuchRails::Mixin

  mixin_included do
    include MuchRails::CallMethod
    include MuchRails::WrapMethod
  end

  mixin_class_methods do
    def wrap_and_call(objects, *args)
      wrap(objects, *args).each(&:call)
    end

    def wrap_and_map_call(objects, *args)
      wrap(objects, *args).map(&:call)
    end

    def wrap_and_capture_call(objects, *args, capturing_result:, **kargs)
      capturing_result.capture_for_all(
        wrap_and_map_call(objects, *args, **kargs),
      )
    end

    def wrap_and_capture_call!(objects, *args, capturing_result:, **kargs)
      capturing_result.capture_for_all!(
        wrap_and_map_call(objects, *args, **kargs),
      )
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
much-rails-0.4.3 lib/much-rails/wrap_and_call_method.rb
much-rails-0.4.2 lib/much-rails/wrap_and_call_method.rb
much-rails-0.4.1 lib/much-rails/wrap_and_call_method.rb
much-rails-0.4.0 lib/much-rails/wrap_and_call_method.rb
much-rails-0.3.0 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.8 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.7 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.6 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.5 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.4 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.3 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.2 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.1 lib/much-rails/wrap_and_call_method.rb
much-rails-0.2.0 lib/much-rails/wrap_and_call_method.rb
much-rails-0.1.3 lib/much-rails/wrap_and_call_method.rb
much-rails-0.1.2 lib/much-rails/wrap_and_call_method.rb
much-rails-0.1.1 lib/much-rails/wrap_and_call_method.rb
much-rails-0.1.0 lib/much-rails/wrap_and_call_method.rb