Module: Lich::Common::UserVars
- Defined in:
- lib/common/uservars.rb
Class Method Summary collapse
-
.add(var_name, value, _t = nil) ⇒ String
Adds a value to a user variable, appending it to the existing value.
-
.change(var_name, value, _t = nil) ⇒ Object
Changes the value of a user variable.
-
.delete(var_name, _t = nil) ⇒ nil
Deletes a user variable by setting it to nil.
-
.list ⇒ Array
Lists all user variables.
-
.list_char ⇒ Array
Lists character-specific user variables.
-
.list_global ⇒ Array
Lists all global user variables.
-
.method_missing(arg1, arg2 = '') ⇒ Object
Handles missing methods for user variables.
Class Method Details
.add(var_name, value, _t = nil) ⇒ String
Note:
This assumes the existing value is a comma-separated string.
Adds a value to a user variable, appending it to the existing value.
61 62 63 |
# File 'lib/common/uservars.rb', line 61 def UserVars.add(var_name, value, _t = nil) Vars[var_name] = Vars[var_name].split(', ').push(value).join(', ') end |
.change(var_name, value, _t = nil) ⇒ Object
Note:
This will overwrite the existing value of the variable.
Changes the value of a user variable.
45 46 47 |
# File 'lib/common/uservars.rb', line 45 def UserVars.change(var_name, value, _t = nil) Vars[var_name] = value end |
.delete(var_name, _t = nil) ⇒ nil
Deletes a user variable by setting it to nil.
74 75 76 |
# File 'lib/common/uservars.rb', line 74 def UserVars.delete(var_name, _t = nil) Vars[var_name] = nil end |
.list ⇒ Array
Lists all user variables.
14 15 16 |
# File 'lib/common/uservars.rb', line 14 def UserVars.list Vars.list end |
.list_char ⇒ Array
Lists character-specific user variables.
96 97 98 |
# File 'lib/common/uservars.rb', line 96 def UserVars.list_char Vars.list end |
.list_global ⇒ Array
Lists all global user variables.
85 86 87 |
# File 'lib/common/uservars.rb', line 85 def UserVars.list_global Array.new end |
.method_missing(arg1, arg2 = '') ⇒ Object
Handles missing methods for user variables.
29 30 31 |
# File 'lib/common/uservars.rb', line 29 def UserVars.method_missing(arg1, arg2 = '') Vars.method_missing(arg1, arg2) end |