Sha256: d676efcde4dc778b098c83e82eea3d47dc238579ef43db4908482770b4b834c5
Contents?: true
Size: 759 Bytes
Versions: 30
Compression:
Stored size: 759 Bytes
Contents
# frozen_string_literal: true class ReeMapper::BuildMapperStrategy include Ree::FnDSL fn :build_mapper_strategy OUTPUT_MAP = { string_key_hash: ReeMapper::StringKeyHashOutput, symbol_key_hash: ReeMapper::SymbolKeyHashOutput, object: ReeMapper::ObjectOutput }.freeze contract(Kwargs[ method: Symbol, output: Symbol, always_optional: Bool ] => ReeMapper::MapperStrategy).throws(ArgumentError) def call(method:, output:, always_optional: false) raise ArgumentError, 'invalid output' unless OUTPUT_MAP.key?(output) ReeMapper::MapperStrategy.new( method: method, output: OUTPUT_MAP.fetch(output).new, always_optional: always_optional ) end end
Version data entries
30 entries across 30 versions & 1 rubygems