Class: Kublog::PostFormPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/kublog/post_form_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ PostFormPresenter

Returns a new instance of PostFormPresenter.



6
7
8
9
10
11
12
# File 'app/presenters/kublog/post_form_presenter.rb', line 6

def initialize(post)
  @post  = post
  @notifications = []
  @notifications << notification('twitter')  if Kublog.twitter?
  @notifications << notification('facebook') if Kublog.facebook?
  @notifications << notification('email') if Kublog.email?
end

Instance Attribute Details

#notificationsObject

Returns the value of attribute notifications.



4
5
6
# File 'app/presenters/kublog/post_form_presenter.rb', line 4

def notifications
  @notifications
end

#postObject

Returns the value of attribute post.



4
5
6
# File 'app/presenters/kublog/post_form_presenter.rb', line 4

def post
  @post
end

Instance Method Details

#notification(kind) ⇒ Object



14
15
16
# File 'app/presenters/kublog/post_form_presenter.rb', line 14

def notification(kind)
  @post.notifications.build(:kind => kind, :post => @post)
end