Module: Lich::Common::Account
- Defined in:
- lib/common/account.rb
Class Method Summary collapse
-
.character ⇒ Object?
Returns the character associated with the account.
-
.character=(value) ⇒ Object
Sets the character associated with the account.
-
.characters ⇒ Array<String>
Returns the names of the characters associated with the account.
-
.game_code ⇒ String?
Returns the game code associated with the account.
-
.game_code=(value) ⇒ String
Sets the game code associated with the account.
-
.members ⇒ Hash
Returns the members associated with the account.
-
.members=(value) ⇒ Hash
Sets the members associated with the account.
-
.name ⇒ String?
Returns the name of the account.
-
.name=(value) ⇒ String
Sets the name of the account.
-
.subscription ⇒ String?
Returns the subscription type of the account.
-
.subscription=(value) ⇒ String
Sets the subscription type of the account.
Class Method Details
.character ⇒ Object?
Returns the character associated with the account.
30 31 32 |
# File 'lib/common/account.rb', line 30 def self.character @@character end |
.character=(value) ⇒ Object
Sets the character associated with the account.
40 41 42 |
# File 'lib/common/account.rb', line 40 def self.character=(value) @@character = value end |
.characters ⇒ Array<String>
Returns the names of the characters associated with the account.
107 108 109 |
# File 'lib/common/account.rb', line 107 def self.characters @@members.values end |
.game_code ⇒ String?
Returns the game code associated with the account.
67 68 69 |
# File 'lib/common/account.rb', line 67 def self.game_code @@game_code end |
.game_code=(value) ⇒ String
Sets the game code associated with the account.
77 78 79 |
# File 'lib/common/account.rb', line 77 def self.game_code=(value) @@game_code = value end |
.members ⇒ Hash
Returns the members associated with the account.
84 85 86 |
# File 'lib/common/account.rb', line 84 def self.members @@members end |
.members=(value) ⇒ Hash
This method processes the input string to extract character codes and names.
Sets the members associated with the account.
95 96 97 98 99 100 101 102 |
# File 'lib/common/account.rb', line 95 def self.members=(value) potential_members = {} for code_name in value.sub(/^C\t[0-9]+\t[0-9]+\t[0-9]+\t[0-9]+[\t\n]/, '').scan(/[^\t]+\t[^\t^\n]+/) char_code, char_name = code_name.split("\t") potential_members[char_code] = char_name end @@members = potential_members end |
.name ⇒ String?
Returns the name of the account.
13 14 15 |
# File 'lib/common/account.rb', line 13 def self.name @@name end |
.name=(value) ⇒ String
Sets the name of the account.
23 24 25 |
# File 'lib/common/account.rb', line 23 def self.name=(value) @@name = value end |
.subscription ⇒ String?
Returns the subscription type of the account.
47 48 49 |
# File 'lib/common/account.rb', line 47 def self.subscription @@subscription end |
.subscription=(value) ⇒ String
Sets the subscription type of the account.
58 59 60 61 62 |
# File 'lib/common/account.rb', line 58 def self.subscription=(value) if value =~ /(NORMAL|PREMIUM|TRIAL|INTERNAL|FREE)/ @@subscription = Regexp.last_match(1) end end |