Module: SmartCore::Initializer::Attribute::Finalizer Private

Defined in:
lib/smart_core/initializer/attribute/finalizer.rb,
lib/smart_core/initializer/attribute/finalizer/anonymous_block.rb,
lib/smart_core/initializer/attribute/finalizer/instance_method.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Defined Under Namespace

Classes: Abstract, AnonymousBlock, InstanceMethod

Class Method Summary collapse

Class Method Details

.create(finalization_approach) ⇒ SmartCore::Initializer::Attribute::Finalizer::InstanceMethod, SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • finalization_approach (String, Symbol, Proc)

Returns:

Since:

  • 0.1.0

Version:

  • 0.8.0



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/smart_core/initializer/attribute/finalizer.rb', line 18

def create(finalization_approach)
  case finalization_approach
  when String, Symbol
    InstanceMethod.new(finalization_approach)
  when Proc
    AnonymousBlock.new(finalization_approach)
  else
    raise(
      SmartCore::Initializer::ArgumentError,
      'Finalization approach object should be a type of Proc, Symbol or String'
    )
  end
end