Class: Pulitzer::UpdateSingletonPost
- Inherits:
-
Object
- Object
- Pulitzer::UpdateSingletonPost
- Defined in:
- app/interactions/pulitzer/update_singleton_post.rb
Instance Attribute Summary collapse
-
#post_type ⇒ Object
Returns the value of attribute post_type.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(post_type, title) ⇒ UpdateSingletonPost
constructor
A new instance of UpdateSingletonPost.
Constructor Details
#initialize(post_type, title) ⇒ UpdateSingletonPost
Returns a new instance of UpdateSingletonPost.
4 5 6 7 |
# File 'app/interactions/pulitzer/update_singleton_post.rb', line 4 def initialize(post_type, title) self.post_type = post_type self.title = title end |
Instance Attribute Details
#post_type ⇒ Object
Returns the value of attribute post_type.
2 3 4 |
# File 'app/interactions/pulitzer/update_singleton_post.rb', line 2 def post_type @post_type end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'app/interactions/pulitzer/update_singleton_post.rb', line 2 def title @title end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/interactions/pulitzer/update_singleton_post.rb', line 9 def call if post_type.singular? unless post_type.singleton_post? Pulitzer::CreateSingletonPost.new(post_type, title).call else post_type.singleton_post.update(title: title) end end end |