Sha256: a979434f4882898f9d522f5c97324e0e22b891377b3cc1e22a50c684ee1493c0
Contents?: true
Size: 554 Bytes
Versions: 1
Compression:
Stored size: 554 Bytes
Contents
module Dry class Struct class Constructor include Dry::Equalizer(: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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-struct-0.3.1 | lib/dry/struct/constructor.rb |