Class: Wowr::Classes::RepFactionCategory
- Inherits:
-
Object
- Object
- Wowr::Classes::RepFactionCategory
- Defined in:
- lib/wowr/character.rb
Overview
Larger group of factions Used for faction information eg Alliance, Shattrath City, Steamwheedle Cartel
Instance Attribute Summary collapse
-
#factions ⇒ Object
readonly
Returns the value of attribute factions.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(elem) ⇒ RepFactionCategory
constructor
A new instance of RepFactionCategory.
- #total ⇒ Object
Constructor Details
#initialize(elem) ⇒ RepFactionCategory
Returns a new instance of RepFactionCategory.
786 787 788 789 790 791 792 793 794 |
# File 'lib/wowr/character.rb', line 786 def initialize(elem) @key = elem[:key] @name = elem[:name] @factions = {} (elem/:faction).each do |faction| @factions[faction[:key]] = RepFaction.new(faction) end end |
Instance Attribute Details
#factions ⇒ Object (readonly)
Returns the value of attribute factions.
783 784 785 |
# File 'lib/wowr/character.rb', line 783 def factions @factions end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
783 784 785 |
# File 'lib/wowr/character.rb', line 783 def key @key end |
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
783 784 785 |
# File 'lib/wowr/character.rb', line 783 def name @name end |
Instance Method Details
#total ⇒ Object
796 797 798 799 800 |
# File 'lib/wowr/character.rb', line 796 def total total = 0 factions.each_value { |faction| total += faction.reputation } return total end |