Class: Bgg::Play::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/bgg/play.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(player) ⇒ Player

Returns a new instance of Player.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bgg/play.rb', line 43

def initialize(player)
	@color = player['color']
	@name = player['name']
	@new = player['new'] == '1'
	@rating = player['rating']
	@score = player['score']
	@start_position = player['startposition']
	@user_id = player['userid']
	@username = player['username']
	@winner = player['win'] == '1'
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



41
42
43
# File 'lib/bgg/play.rb', line 41

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/bgg/play.rb', line 41

def name
  @name
end

#ratingObject (readonly)

Returns the value of attribute rating.



41
42
43
# File 'lib/bgg/play.rb', line 41

def rating
  @rating
end

#scoreObject (readonly)

Returns the value of attribute score.



41
42
43
# File 'lib/bgg/play.rb', line 41

def score
  @score
end

#start_positionObject (readonly)

Returns the value of attribute start_position.



41
42
43
# File 'lib/bgg/play.rb', line 41

def start_position
  @start_position
end

#user_idObject (readonly)

Returns the value of attribute user_id.



41
42
43
# File 'lib/bgg/play.rb', line 41

def user_id
  @user_id
end

#usernameObject (readonly)

Returns the value of attribute username.



41
42
43
# File 'lib/bgg/play.rb', line 41

def username
  @username
end

Instance Method Details

#new?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/bgg/play.rb', line 55

def new?
	@new
end

#winner?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/bgg/play.rb', line 59

def winner?
	@winner
end