Module: ARSettings::SettingsClass::InstanceMethods

Defined in:
lib/arsettings/settings_class/instance_methods.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#postprocessingObject

unfortunately, can’t serialize a proc. I tried both yaml and marshal so will have to keep it in memory and just be sure to set it each time app loads



7
8
9
# File 'lib/arsettings/settings_class/instance_methods.rb', line 7

def postprocessing
  @postprocessing
end

Instance Method Details

#packageObject



35
36
37
# File 'lib/arsettings/settings_class/instance_methods.rb', line 35

def package
  @package ||= super.to_sym
end

#package=(pkg) ⇒ Object



39
40
41
# File 'lib/arsettings/settings_class/instance_methods.rb', line 39

def package=(pkg)
  super pkg.to_s
end

#valueObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/arsettings/settings_class/instance_methods.rb', line 17

def value
  @value_is_deserialized ||= false # just to clear a stupid warning
  if @value_is_deserialized && !volatile?
    @deserialized_value
  else
    raise UninitializedSettingError.new("#{package}##{name} has not been initialized.") unless super
    reload
    @value_is_deserialized = true
    @deserialized_value = ARSettings.deserialize(super)
    @deserialized_value
  end
end

#value=(new_value) ⇒ Object



10
11
12
13
14
15
# File 'lib/arsettings/settings_class/instance_methods.rb', line 10

def value=(new_value)
  @deserialized_value = new_value
  @value_is_deserialized = true
  super ARSettings.serialize(new_value)
  save
end

#volatile=(value) ⇒ Object



30
31
32
33
# File 'lib/arsettings/settings_class/instance_methods.rb', line 30

def volatile=(value)
  super
  save
end