Class: Armory::Guild
- Inherits:
-
Object
- Object
- Armory::Guild
- Defined in:
- lib/armory/guild.rb
Defined Under Namespace
Classes: Character
Instance Attribute Summary collapse
-
#characters ⇒ Object
Returns the value of attribute characters.
-
#faction_id ⇒ Object
Returns the value of attribute faction_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#realm ⇒ Object
Returns the value of attribute realm.
Class Method Summary collapse
Instance Method Summary collapse
- #faction ⇒ Object
-
#initialize ⇒ Guild
constructor
A new instance of Guild.
Constructor Details
#initialize ⇒ Guild
Returns a new instance of Guild.
5 6 7 |
# File 'lib/armory/guild.rb', line 5 def initialize @characters = [] end |
Instance Attribute Details
#characters ⇒ Object
Returns the value of attribute characters.
3 4 5 |
# File 'lib/armory/guild.rb', line 3 def characters @characters end |
#faction_id ⇒ Object
Returns the value of attribute faction_id.
3 4 5 |
# File 'lib/armory/guild.rb', line 3 def faction_id @faction_id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/armory/guild.rb', line 3 def name @name end |
#realm ⇒ Object
Returns the value of attribute realm.
3 4 5 |
# File 'lib/armory/guild.rb', line 3 def realm @realm end |
Class Method Details
.from_armory(doc) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/armory/guild.rb', line 13 def self.from_armory(doc) Guild.new.tap do |guild| info = doc.css("guildInfo") header = info.css("guildHeader") guild.name = header.attr("name").value guild.realm = header.attr("realm").value guild.faction_id = header.attr("faction").value.to_i info.css("guild members character").each do |member| guild.characters << Armory::Guild::Character.new( member.attr('name'), member.attr('rank').to_i, member.attr('level').to_i, member.attr('classId').to_i, member.attr('genderId').to_i, member.attr('raceId').to_i ) end end end |