module GameCredits
Constants
- GAME_PLUGINS
Public Instance Methods
Source
# File lib/game_credits.rb, line 17 def balance_for(user, store: Game.default_store) Game.balance_for(user, store: store) end
Source
# File lib/game_credits.rb, line 21 def balances_for(user) stores.map do |name, store| { game: name, balance: balance_for(user, store: store) } end end
Source
# File lib/game_credits.rb, line 31 def cross_leaderboard(limit: 10, store: Game.default_store) Game.leaderboard(store: store).first(limit) end
Source
# File lib/game_credits.rb, line 40 def format_top_report(store: Game.default_store) Game.format_leaderboard(store, title: "Credits leaderboard", empty_message: "No balances yet") end
Source
# File lib/game_credits.rb, line 35 def format_user_report(user, store: Game.default_store) balance = balance_for(user, store: store) Game.format_balance(user, balance, title: "Credits") end
Source
# File lib/game_credits.rb, line 11 def stores { "shared" => Game.default_store } end
Source
# File lib/game_credits.rb, line 27 def total_for(user) balances_for(user).sum { |entry| entry[:balance].to_i } end