Sha256: 3add029154d9e9f912e07b3b6e5e6dfc2b7f72a9be430d4b22e0f71527898aab
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true # @api private # @since 0.1.0 module SmartCore::Initializer::Attribute::Finalizer require_relative 'finalizer/instance_method' require_relative 'finalizer/anonymous_block' # @return [Proc] # # @api private # @since 0.1.0 DEFAULT_FINALIZER = proc { |value| value }.freeze 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smart_initializer-0.0.0 | lib/smart_core/initializer/attribute/finalizer.rb |