Class: Australium::PlayerJoinTeam
- Defined in:
- lib/australium/events/player_join_team.rb
Constant Summary collapse
- LOG_REGEX =
/"(?<player>.+)" joined team "(?<team>.+)"/
Constants inherited from Event
Event::PROPERTY_REGEX, Event::TIMESTAMP_REGEX
Instance Attribute Summary collapse
-
#player ⇒ Player
The Player who joined the team.
-
#team ⇒ String
The name of the team the player joined.
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data) ⇒ PlayerJoinTeam
constructor
A new instance of PlayerJoinTeam.
Methods inherited from Event
Constructor Details
#initialize(data) ⇒ PlayerJoinTeam
Returns a new instance of PlayerJoinTeam.
11 12 13 14 15 16 17 |
# File 'lib/australium/events/player_join_team.rb', line 11 def initialize(data) super(data) unless state.nil? player = state.players.find { |p| p.nick == self.player.nick } player.team = team end end |
Instance Attribute Details
#player ⇒ Player
Returns the Australium::Player who joined the team.
11 12 13 14 15 16 17 |
# File 'lib/australium/events/player_join_team.rb', line 11 def initialize(data) super(data) unless state.nil? player = state.players.find { |p| p.nick == self.player.nick } player.team = team end end |
#team ⇒ String
Returns the name of the team the player joined.
11 12 13 14 15 16 17 |
# File 'lib/australium/events/player_join_team.rb', line 11 def initialize(data) super(data) unless state.nil? player = state.players.find { |p| p.nick == self.player.nick } player.team = team end end |