Class: NerdTown::Guild::MemberCollectionParser
- Inherits:
-
Object
- Object
- NerdTown::Guild::MemberCollectionParser
- Defined in:
- lib/nerd_town/guild.rb
Defined Under Namespace
Classes: GuildMember, MemberCollection
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#raw_collection ⇒ Object
readonly
Returns the value of attribute raw_collection.
Instance Method Summary collapse
-
#initialize(raw_collection) ⇒ MemberCollectionParser
constructor
A new instance of MemberCollectionParser.
- #parse ⇒ Object
Constructor Details
#initialize(raw_collection) ⇒ MemberCollectionParser
Returns a new instance of MemberCollectionParser.
39 40 41 42 |
# File 'lib/nerd_town/guild.rb', line 39 def initialize(raw_collection) @raw_collection = raw_collection @collection = MemberCollection.new end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
38 39 40 |
# File 'lib/nerd_town/guild.rb', line 38 def collection @collection end |
#raw_collection ⇒ Object (readonly)
Returns the value of attribute raw_collection.
38 39 40 |
# File 'lib/nerd_town/guild.rb', line 38 def raw_collection @raw_collection end |
Instance Method Details
#parse ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/nerd_town/guild.rb', line 44 def parse raw_collection.each do |raw_member| char_attrs = raw_member["character"] member = GuildMember.new(name: char_attrs["name"], realm: char_attrs["realm"], thumbnail: char_attrs["thumbnail"], class: char_attrs["class"], rank: raw_member["rank"], race: char_attrs["race"]) collection.push(member) end collection end |