Class: SimulatorTimeline::Lorem

Inherits:
Object
  • Object
show all
Includes:
LoremMessages
Defined in:
app/models/simulator_timeline/lorem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LoremMessages

#a_knock_message, #an_animal_message, #canceled_message, #card_kind_message, #card_message, #cornerkick_message, #current_home_player_message, #current_player_message, #current_visitor_player_message, #finished_message, #first_interval_message, #first_period_message, #first_prorrogation_message, #foul_message, #funny_message, #goal_kind_message, #goal_message, #home_player_message, #infringement_message, #lorem_message, #not_started_message, #penalties_message, #player_message, #second_interval_message, #second_period_message, #second_prorrogation_message, #sidekick_message, #stopped_match_message, #substitution_message, #third_interval_message, #trolled_person_message, #visitor_player_message

Constructor Details

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

Returns a new instance of Lorem.



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

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



10
11
12
13
14
15
# File 'app/models/simulator_timeline/lorem.rb', line 10

def method_missing(method_name, *args, &block)
  return render(@options[method_name])                         if @options[method_name]
  return render(send("#{method_name}_message", *args, &block)) if respond_to?("#{method_name}_message")
  return @timeline.public_send(method_name, *args, &block)     if @timeline.respond_to?(method_name)
  super(method_name, *args, &block)
end

Instance Attribute Details

#minuteObject (readonly)

Returns the value of attribute minute.



3
4
5
# File 'app/models/simulator_timeline/lorem.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/lorem.rb', line 3

def period_time
  @period_time
end

#timelineObject (readonly)

Returns the value of attribute timeline.



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

def timeline
  @timeline
end