class NerdTown::Guild::MemberCollectionParser

Attributes

collection[R]
raw_collection[R]

Public Class Methods

new(raw_collection) click to toggle source
# File lib/nerd_town/guild.rb, line 39
def initialize(raw_collection)
  @raw_collection = raw_collection
  @collection = MemberCollection.new
end

Public Instance Methods

parse() click to toggle source
# 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