Sha256: f20f48bc79ddbdd88236dedb9c5d1e11475380622b420a70f29fa2aaafc9db4d
Contents?: true
Size: 936 Bytes
Versions: 9
Compression:
Stored size: 936 Bytes
Contents
# frozen_string_literal: true require "dry/initializer" require "dry/validation/constants" module Dry module Validation # Abstract class for handling rule blocks # # @see Rule # @see Macro # # @api private class Function extend Dry::Initializer # @!attribute [r] block # @return [Proc] # @api private option :block # @!attribute [r] block_options # @return [Hash] # @api private option :block_options, default: -> { block ? map_keywords(block) : EMPTY_HASH } private # Extract options for the block kwargs # # @param [Proc] block Callable # @return Hash # # @api private def map_keywords(block) block .parameters .select { |arg,| arg.equal?(:keyreq) } .map { |_, name| [name, BLOCK_OPTIONS_MAPPINGS[name]] } .to_h end end end end
Version data entries
9 entries across 9 versions & 1 rubygems