Class: Edgeville::Player
- Inherits:
-
Object
- Object
- Edgeville::Player
- Defined in:
- lib/edgeville.rb
Constant Summary collapse
- SKILL_LIST =
%w(Overall Attack Defence Strength Hitpoints Ranged Prayer Magic Cooking Woodcutting Fletching Fishing Firemaking Crafting Smithing Mining Herblore Agility Thieving Slayer Farming Runecraft Construction Hunter Summoning)
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #clean_name ⇒ Object
-
#initialize(name) ⇒ Player
constructor
A new instance of Player.
- #skills ⇒ Object
Constructor Details
#initialize(name) ⇒ Player
Returns a new instance of Player.
9 10 11 |
# File 'lib/edgeville.rb', line 9 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/edgeville.rb', line 6 def name @name end |
Instance Method Details
#clean_name ⇒ Object
13 14 15 |
# File 'lib/edgeville.rb', line 13 def clean_name @name.gsub(/[^\w]/,"_").downcase end |
#skills ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/edgeville.rb', line 17 def skills stats = {} SKILL_LIST.each_with_index do |skill,i| line = highscores[i].split(",") stats[skill.downcase.to_sym] = { :rank => line[0].to_i, :level => line[1].to_i, :xp => line[2].to_i } end stats end |