Class: SimulatorTimeline::NarrationEvent
- Defined in:
- app/models/simulator_timeline/narration_event.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#moment ⇒ Object
readonly
Returns the value of attribute moment.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
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 = {}) ⇒ NarrationEvent
constructor
A new instance of NarrationEvent.
- #to_foot_stats ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(event_handler, timeline, period_time, minute, options = {}) ⇒ NarrationEvent
Returns a new instance of NarrationEvent.
5 6 7 8 9 10 |
# File 'app/models/simulator_timeline/narration_event.rb', line 5 def initialize(event_handler, timeline, period_time, minute, = {}) super(event_handler, timeline, period_time, minute, ) @message, @reference = .values_at :message, :reference @source_id = @timeline.timeline_rand(10**7)+1 @moment = format "%02d:%02d", period_time, @timeline.timeline_rand(60) end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'app/models/simulator_timeline/narration_event.rb', line 3 def @message end |
#moment ⇒ Object (readonly)
Returns the value of attribute moment.
3 4 5 |
# File 'app/models/simulator_timeline/narration_event.rb', line 3 def moment @moment end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
3 4 5 |
# File 'app/models/simulator_timeline/narration_event.rb', line 3 def reference @reference end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
3 4 5 |
# File 'app/models/simulator_timeline/narration_event.rb', line 3 def source_id @source_id end |
Class Method Details
.remove(timeline, reference) ⇒ Object
26 27 28 |
# File 'app/models/simulator_timeline/narration_event.rb', line 26 def self.remove(timeline, reference) timeline.narration.delete_if{ |event| event.reference == reference } end |
.to_foot_stats(array_of_narrations) ⇒ Object
30 31 32 |
# File 'app/models/simulator_timeline/narration_event.rb', line 30 def self.to_foot_stats(array_of_narrations) fuck_collection 'Narracao', array_of_narrations.map(&:to_foot_stats) end |
Instance Method Details
#to_foot_stats ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/simulator_timeline/narration_event.rb', line 12 def to_foot_stats { "@Id" => @source_id, "IdEquipe" => "", "NomeEquipe" => "", "IdJogador" => "", "NomeJogador" => "", "Periodo" => SimulatorMatch::STATUS_MAP[SimulatorMatch::STATUSES[@period_time]], "Momento" => @moment, "Descricao" => @message, "Acao" => "" } end |