Class: SimulatorTimeline::GoalEvent
- Defined in:
- app/models/simulator_timeline/goal_event.rb
Instance Attribute Summary collapse
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Event
#event_handler, #minute, #period_time
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event_handler, timeline, period_time, minute, options = {}) ⇒ GoalEvent
constructor
A new instance of GoalEvent.
- #to_foot_stats ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(event_handler, timeline, period_time, minute, options = {}) ⇒ GoalEvent
Returns a new instance of GoalEvent.
5 6 7 8 9 |
# File 'app/models/simulator_timeline/goal_event.rb', line 5 def initialize(event_handler, timeline, period_time, minute, = {}) @player, @type, @reference = .values_at :player, :type, :reference @type ||= 'Favor' super(event_handler, timeline, period_time, minute, ) end |
Instance Attribute Details
#player ⇒ Object (readonly)
Returns the value of attribute player.
3 4 5 |
# File 'app/models/simulator_timeline/goal_event.rb', line 3 def player @player end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
3 4 5 |
# File 'app/models/simulator_timeline/goal_event.rb', line 3 def reference @reference end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'app/models/simulator_timeline/goal_event.rb', line 3 def type @type end |
Class Method Details
.remove(timeline, reference) ⇒ Object
20 21 22 23 |
# File 'app/models/simulator_timeline/goal_event.rb', line 20 def self.remove(timeline, reference) timeline.home_goals.delete_if{ |event| event.reference == reference } timeline.visitor_goals.delete_if{ |event| event.reference == reference } end |
.to_foot_stats(array_of_goals) ⇒ Object
25 26 27 |
# File 'app/models/simulator_timeline/goal_event.rb', line 25 def self.to_foot_stats(array_of_goals) fuck_collection 'Gol', array_of_goals.map(&:to_foot_stats) end |
Instance Method Details
#to_foot_stats ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/simulator_timeline/goal_event.rb', line 11 def to_foot_stats { "@Jogador" => @player.full_name, "@Periodo" => SimulatorMatch::STATUS_MAP[SimulatorMatch::STATUSES[@period_time]], "@Minuto" => @minute.to_s, "@Tipo" => @type } end |