Module: SmartCore::Initializer::Attribute::Builder Private

Defined in:
lib/smart_core/initializer/attribute/builder.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.5.0

Constant Summary collapse

DEFAULT_FINALIZE =

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

Returns:

  • (Proc)

Since:

  • 0.5.0

-> (value) { value }.freeze

Class Method Summary collapse

Class Method Details

.build(name, type: :__any__, privacy: :default, finalize: DEFAULT_FINALIZE, **options) ⇒ SmartCore::Initializer::Attribute

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:

  • name (String, Symbol)
  • options (Hash<Symbol,Any>)
    • :default (see SmartCore::Initializer::Attribute#initialize)

    • :finalize (see SmartCore::Initializer::Attribute#initialize)

  • type (Hash) (defaults to: :__any__)

    a customizable set of options

  • privacy (Hash) (defaults to: :default)

    a customizable set of options

Options Hash (type:):

  • (Symbol)

Options Hash (privacy:):

  • (Symbol, String)

Returns:

Raises:

Since:

  • 0.5.0



28
29
30
31
32
33
34
35
# File 'lib/smart_core/initializer/attribute/builder.rb', line 28

def build(name, type: :__any__, privacy: :default, finalize: DEFAULT_FINALIZE, **options)
  name      = represent_name_attr(name)
  type      = represent_type_attr(type)
  privacy   = represent_privacy_attr(privacy)
  finalizer = represent_finalizer_attr(finalize)

  SmartCore::Initializer::Attribute.new(name, type, privacy, finalizer, **options)
end