Class: MyTimeline::EventPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/my_timeline/event_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ EventPresenter

Returns a new instance of EventPresenter.



6
7
8
# File 'app/presenters/my_timeline/event_presenter.rb', line 6

def initialize(event)
  @event = event
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object (private)



39
40
41
42
43
44
45
# File 'app/presenters/my_timeline/event_presenter.rb', line 39

def method_missing(meth, *args, &blk)
  if event.respond_to?(meth)
    event.send meth, *args
  else
    super
  end
end

Instance Attribute Details

#eventObject

Returns the value of attribute event.



4
5
6
# File 'app/presenters/my_timeline/event_presenter.rb', line 4

def event
  @event
end

Instance Method Details

#happened_onObject



14
15
16
# File 'app/presenters/my_timeline/event_presenter.rb', line 14

def happened_on
  time.strftime MyTimeline.time_formatter
end

#icon_pathObject



10
11
12
# File 'app/presenters/my_timeline/event_presenter.rb', line 10

def icon_path
  "my_timeline/icons/#{event.icon_name}"
end

#idObject



18
19
20
# File 'app/presenters/my_timeline/event_presenter.rb', line 18

def id
  event.id
end