Class: SimulatorTimeline::Event

Inherits:
Object
  • Object
show all
Defined in:
app/models/simulator_timeline/event.rb

Direct Known Subclasses

CardEvent, GoalEvent, NarrationEvent, PlayerEvent

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_handler, timeline, period_time, minute, options = {}) ⇒ Event

Returns a new instance of Event.



5
6
7
8
# File 'app/models/simulator_timeline/event.rb', line 5

def initialize(event_handler, timeline, period_time, minute, options = {})
  @event_handler, @timeline, @period_time, @minute = event_handler, timeline, period_time, minute
  apply_event
end

Instance Attribute Details

#event_handlerObject (readonly)

Returns the value of attribute event_handler.



3
4
5
# File 'app/models/simulator_timeline/event.rb', line 3

def event_handler
  @event_handler
end

#minuteObject (readonly)

Returns the value of attribute minute.



3
4
5
# File 'app/models/simulator_timeline/event.rb', line 3

def minute
  @minute
end

#period_timeObject (readonly)

Returns the value of attribute period_time.



3
4
5
# File 'app/models/simulator_timeline/event.rb', line 3

def period_time
  @period_time
end

Class Method Details

.fuck_collection(key, collection) ⇒ Object

Yeah… FootStats fucks collection…



15
16
17
18
19
20
21
22
23
24
# File 'app/models/simulator_timeline/event.rb', line 15

def self.fuck_collection(key, collection)
  case collection.size
  when 0
    nil
  when 1
    { key => collection.first }
  else
    { key => collection }
  end
end

Instance Method Details

#<=>(other) ⇒ Object



10
11
12
# File 'app/models/simulator_timeline/event.rb', line 10

def <=>(other)
  [@period_time, @minute] <=> [other.period_time, other.minute]
end