Sha256: c3b7f2b558f255dac12c4fbfbb2d24a140a5b0e42b7803de295d82d12bc30187
Contents?: true
Size: 977 Bytes
Versions: 13
Compression:
Stored size: 977 Bytes
Contents
# frozen_string_literal: true # @api private # @since 0.1.0 module SmartCore::Initializer::Attribute::Finalizer require_relative 'finalizer/abstract' require_relative 'finalizer/instance_method' require_relative 'finalizer/anonymous_block' class << self # @param finalization_approach [String, Symbol, Proc] # @return [SmartCore::Initializer::Attribute::Finalizer::InstanceMethod] # @return [SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock] # # @api private # @since 0.1.0 def create(finalization_approach) case finalization_approach when String, Symbol InstanceMethod.new(finalization_approach) when Proc AnonymousBlock.new(finalization_approach) else # :nocov: raise(SmartCore::Initializer::ArgumentError, <<~ERROR_MESSAGE) Finalization approach should be a type of Proc, Symbol or String' ERROR_MESSAGE # :nocov: end end end end
Version data entries
13 entries across 13 versions & 1 rubygems