class TriviaCrack::User
Attributes
Public: The amount of coins that the user has accumulated.
Public: The country code of the user's country.
Public: The number of extra shots available to the user.
Public: The Facebook ID of the user (nil if the user has not linked their Facebook account).
Public: The Facebook name of the user (nil if the user has not linked their Facebook account).
Public: The user's goal points.
Public: The unique identifier of the user.
Public: The user's level.
Public: The experience points that the user has accumulated towards their next level.
Public: The percentage progress towards the next level.
Public: Boolean indicating whether the user has leveled up.
Public: The amount of lives available to the user.
Public: The maximum number of lives that the user can have.
Public: Boolean indicating whether the user has unlimited lives.
Public: The unique username of the user.
Public Class Methods
# File lib/triviacrack/user.rb, line 54 def initialize(id:, username: nil, facebook_id: nil, facebook_name: nil, coins: nil, lives: nil, max_lives: nil, unlimited_lives: nil, country: nil, extra_shots: nil, level: nil, level_points: nil, level_progress: nil, goal_points: nil, level_up: nil) @id = id @username = username @facebook_id = facebook_id @facebook_name = facebook_name @coins = coins @lives = lives @max_lives = max_lives @unlimited_lives = unlimited_lives @country = country @extra_shots = extra_shots @level = level @level_points = level_points @level_progress = level_progress @goal_points = goal_points @level_up = level_up end
Public Instance Methods
Public: Returns true if the user has one or more lives, or has unlimited lives.
Examples
if user.start_new_game? ... start a new game ... end
Returns true if the user can start a new game, false otherwise.
# File lib/triviacrack/user.rb, line 86 def start_new_game? @lives >= 1 || @unlimited_lives end