class PlaylyfeClient::V2::PlayerCollection

Public Class Methods

new(game) click to toggle source
Calls superclass method PlaylyfeClient::V2::Collection::new
# File lib/playlyfe_client/v2/collection/player_collection.rb, line 13
def initialize(game)  
  super
  @items=[]
  fill_items(@game.connection.get_player_hash_array)
end

Public Instance Methods

find(str) click to toggle source
# File lib/playlyfe_client/v2/collection/player_collection.rb, line 7
def find(str)
  (@items.detect {|pl| pl.alias.include?(str) || pl.id.include?(str)})
end

Private Instance Methods

fill_items(player_hash_array) click to toggle source
# File lib/playlyfe_client/v2/collection/player_collection.rb, line 19
def fill_items(player_hash_array)  
  player_hash_array.each do |player_hash|
    @items << PlaylyfeClient::V2::Player.new(player_hash, @game)
  end  
end