Class: Wowr::Classes::RepFactionCategory

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#factionsObject (readonly)

Returns the value of attribute factions.



783
784
785
# File 'lib/wowr/character.rb', line 783

def factions
  @factions
end

#keyObject (readonly)

Returns the value of attribute key.



783
784
785
# File 'lib/wowr/character.rb', line 783

def key
  @key
end

#nameObject (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

#totalObject



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