Module: Lich::Common::CharSettings
- Defined in:
- documented/common/settings/charsettings.rb
Class Method Summary collapse
-
.[](name) ⇒ OpenStruct
Retrieves a scoped setting by name.
-
.[]=(name, value) ⇒ void
Sets a scoped setting by name.
-
.active_scope ⇒ String
Returns the active scope for character settings.
-
.to_hash ⇒ OpenStruct
Converts the character settings to a hash-like structure.
Class Method Details
.[](name) ⇒ OpenStruct
Retrieves a scoped setting by name.
19 20 21 |
# File 'documented/common/settings/charsettings.rb', line 19 def self.[](name) Settings.get_scoped_setting(active_scope, name) end |
.[]=(name, value) ⇒ void
This method returns an undefined value.
Sets a scoped setting by name.
28 29 30 |
# File 'documented/common/settings/charsettings.rb', line 28 def self.[]=(name, value) Settings.set_script_settings(active_scope, name, value) end |
.active_scope ⇒ String
Returns the active scope for character settings.
This scope is a combination of the current game and character name.
10 11 12 13 |
# File 'documented/common/settings/charsettings.rb', line 10 def self.active_scope # Ensure XMLData.game and XMLData.name are available and up-to-date when scope is needed "#{XMLData.game}:#{XMLData.name}" end |
.to_hash ⇒ OpenStruct
Converts the character settings to a hash-like structure.
This method returns a root proxy for the character settings scope, allowing persistent modifications on the returned object for legacy support.
37 38 39 40 41 42 |
# File 'documented/common/settings/charsettings.rb', line 37 def self.to_hash # NB: This method does not behave like a standard Ruby hash request. # It returns a root proxy for the character settings scope, allowing persistent # modifications on the returned object for legacy support. Settings.wrap_value_if_container(Settings.current_script_settings(active_scope), active_scope, []) end |