Sha256: 3c6c7e745c426984282dffc25656bf2d57fd42a5d9f97d160c990f3d4f2b7a0a
Contents?: true
Size: 1.15 KB
Versions: 10
Compression:
Stored size: 1.15 KB
Contents
require_relative "../collection.rb" require_relative "../leaderboard/unknown_leaderboard.rb" require_relative "../leaderboard/teams_leaderboard.rb" require_relative "../leaderboard/players_leaderboard.rb" module PlaylyfeClient module V2 class LeaderboardCollection < PlaylyfeClient::V2::Collection def find(str) (@items.detect {|pl| pl.name == str || pl.id == str}) end def for_teams @items.select {|lbd| lbd.kind_of?(PlaylyfeClient::V2::TeamsLeaderboard)} end def for_players @items.select {|lbd| lbd.kind_of?(PlaylyfeClient::V2::PlayersLeaderboard)} end private def initialize(game) super @items=[] fill_items(game.connection.get_full_leaderboards_array) end def fill_items(hash_array) hash_array.each do |definition_hash| data_hash=game.connection.get_full_leaderboard_hash(definition_hash["id"]) @items << PlaylyfeClient::V2::UnknownLeaderboard.create_from(definition_hash.merge(data_hash), @game) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems