Sha256: 442ef2fd14ce56b3ed0215f6a9434e25c162f8399e7248c4b602b38826f48f68

Contents?: true

Size: 683 Bytes

Versions: 10

Compression:

Stored size: 683 Bytes

Contents

require_relative "../collection.rb"
require_relative "../player.rb"

module PlaylyfeClient
  module V2
    class PlayerCollection < PlaylyfeClient::V2::Collection
      def find(str)
        (@items.detect {|pl| pl.alias.include?(str) || pl.id.include?(str)})
      end  
      
      private

        def initialize(game)  
          super
          @items=[]
          fill_items(@game.connection.get_player_hash_array)
        end
        
        def fill_items(player_hash_array)  
          player_hash_array.each do |player_hash|
            @items << PlaylyfeClient::V2::Player.new(player_hash, @game)
          end  
        end  

         
    end  
  end
end    
     
 

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
playlyfe_client-1.1.6 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.1.5 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.1.3 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.1.2 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.1.1 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.1.0 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.0.6 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.0.5 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.0.4 lib/playlyfe_client/v2/collection/player_collection.rb
playlyfe_client-1.0.2 lib/playlyfe_client/v2/collection/player_collection.rb