Sha256: 234b9cd27b50c590b068e15b8a4f2d5b55a98c66da6fc00d85336ba94e462ecf
Contents?: true
Size: 585 Bytes
Versions: 9
Compression:
Stored size: 585 Bytes
Contents
module Dry class Struct class Constructor include Dry::Equalizer(:type) include Dry::Types::Type # @return [#call] attr_reader :fn # @return [#call] attr_reader :type # @param [Struct] type # @param [Hash] options # @param [#call, nil] block def initialize(type, options = {}, &block) @type = type @fn = options.fetch(:fn, block) end # @param [Object] input # @return [Object] def call(input) type[fn[input]] end alias_method :[], :call end end end
Version data entries
9 entries across 9 versions & 1 rubygems