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