Class: Pakyow::Support::Configurable::Setting Private

Inherits:
Object
  • Object
show all
Extended by:
DeepFreeze
Defined in:
lib/pakyow/support/configurable/setting.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.

API:

  • private

Instance Method Summary collapse

Methods included from DeepFreeze

extended, inherited, unfreezable

Constructor Details

#initialize(default:, configurable:, &block) ⇒ Setting

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 a new instance of Setting.

API:

  • private



16
17
18
# File 'lib/pakyow/support/configurable/setting.rb', line 16

def initialize(default:, configurable:, &block)
  @default, @block, @configurable = default, block, configurable
end

Instance Method Details

#freezeObject

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.

API:

  • private



25
26
27
28
# File 'lib/pakyow/support/configurable/setting.rb', line 25

def freeze
  value
  super
end

#initialize_copy(_) ⇒ Object

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.

API:

  • private



20
21
22
23
# File 'lib/pakyow/support/configurable/setting.rb', line 20

def initialize_copy(_)
  @default = @default.deep_dup
  super
end

#set(value) ⇒ Object

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.

API:

  • private



30
31
32
# File 'lib/pakyow/support/configurable/setting.rb', line 30

def set(value)
  @value = value
end

#update_configurable(configurable) ⇒ Object

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.

API:

  • private



46
47
48
# File 'lib/pakyow/support/configurable/setting.rb', line 46

def update_configurable(configurable)
  @configurable = configurable
end

#valueObject

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.

API:

  • private



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pakyow/support/configurable/setting.rb', line 34

def value
  if instance_variable_defined?(:@value)
    @value
  else
    @value = if @block
      @configurable.instance_eval(&@block)
    else
      @default
    end
  end
end