Sha256: 415cf03c8f9b940a08599fe78806b048aa9457bb68d6900130a040c3b3c12ab9

Contents?: true

Size: 717 Bytes

Versions: 6

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Utils
    module Array
      class FindLast < Support::Command
        ##
        # @!attribute [r] array
        #   @return [Array]
        #
        attr_reader :array

        ##
        # @!attribute [r] block
        #   @return [Proc]
        #
        attr_reader :block

        ##
        # @param array [Array]
        # @param block [Proc, nil]
        # @return [void]
        #
        def initialize(array, &block)
          @array = array
          @block = block
        end

        ##
        # @return [Object] Can be any type.
        #
        def call
          array.reverse.find(&block)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/utils/array/find_last.rb
convenient_service-0.16.0 lib/convenient_service/utils/array/find_last.rb
convenient_service-0.15.0 lib/convenient_service/utils/array/find_last.rb
convenient_service-0.14.0 lib/convenient_service/utils/array/find_last.rb
convenient_service-0.13.0 lib/convenient_service/utils/array/find_last.rb
convenient_service-0.12.0 lib/convenient_service/utils/array/find_last.rb