Module: SmartCore::Engine::Frozener

Defined in:
lib/smart_core/engine/frozener.rb

Overview

Since:

  • 0.8.0

Version:

  • 0.9.0

Defined Under Namespace

Modules: Mixin

Constant Summary collapse

FROZENER =

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:

  • (UnboundMethod)

Since:

  • 0.8.0

Object.new.method(:freeze).unbind.tap(&:freeze)
FROZEN_CHECK =

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:

  • (UnboundMethod)

Since:

  • 0.8.0

Object.new.method(:frozen?).unbind.tap(&:freeze)

Class Method Summary collapse

Class Method Details

.freeze(object) ⇒ object

Parameters:

  • object (Any)

Returns:

  • (object)

Since:

  • 0.8.0

Version:

  • 0.9.0



46
47
48
49
50
51
# File 'lib/smart_core/engine/frozener.rb', line 46

def freeze(object)
  # rubocop:disable Performance/BindCall
  # NOTE: disabled in order to support older Ruby versions than Ruby@3
  FROZENER.bind(object).call
  # rubocop:enable Performance/BindCall
end

.frozen?(object) ⇒ Boolean

Parameters:

  • object (Any)

Returns:

  • (Boolean)

Since:

  • 0.8.0

Version:

  • 0.9.0



59
60
61
62
63
64
# File 'lib/smart_core/engine/frozener.rb', line 59

def frozen?(object)
  # rubocop:disable Performance/BindCall
  # NOTE: disabled in order to support older Ruby versions than Ruby@3
  FROZEN_CHECK.bind(object).call
  # rubocop:enable Performance/BindCall
end