Class: SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock Private

Inherits:
Abstract
  • Object
show all
Defined in:
lib/smart_core/initializer/attribute/finalizer/anonymous_block.rb

Overview

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

Since:

  • 0.1.0

Instance Method Summary collapse

Methods inherited from Abstract

#dup

Constructor Details

#initialize(finalizer) ⇒ void

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:

  • finalizer (Proc)

Since:

  • 0.1.0



12
13
14
# File 'lib/smart_core/initializer/attribute/finalizer/anonymous_block.rb', line 12

def initialize(finalizer)
  @finalizer = finalizer
end

Instance Method Details

#call(value, instance) ⇒ value

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:

  • value (Any)
  • instance (Any)

Returns:

  • (value)

Since:

  • 0.1.0



22
23
24
# File 'lib/smart_core/initializer/attribute/finalizer/anonymous_block.rb', line 22

def call(value, instance)
  instance.instance_exec(value, &finalizer)
end

#default_identity?Boolean

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.

Returns true only when wrapping the shared identity default, which returns its argument untouched (so a value validated before the call is still valid after it).

Returns:

  • (Boolean)

    true only when wrapping the shared identity default, which returns its argument untouched (so a value validated before the call is still valid after it).

Since:

  • 0.12.1



32
33
34
# File 'lib/smart_core/initializer/attribute/finalizer/anonymous_block.rb', line 32

def default_identity?
  finalizer.equal?(SmartCore::Initializer::Attribute::Value::Base::DEFAULT_FINALIZER)
end