Class: MyTimeline::EventPresenter
- Inherits:
-
Object
- Object
- MyTimeline::EventPresenter
show all
- Defined in:
- app/presenters/my_timeline/event_presenter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
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
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
#event ⇒ Object
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_on ⇒ Object
14
15
16
|
# File 'app/presenters/my_timeline/event_presenter.rb', line 14
def happened_on
time.strftime MyTimeline.time_formatter
end
|
#icon_path ⇒ Object
10
11
12
|
# File 'app/presenters/my_timeline/event_presenter.rb', line 10
def icon_path
"my_timeline/icons/#{event.icon_name}"
end
|
#id ⇒ Object
18
19
20
|
# File 'app/presenters/my_timeline/event_presenter.rb', line 18
def id
event.id
end
|