Class: PostManager
- Inherits:
-
Object
show all
- Defined in:
- app/services/post_manager.rb
Defined Under Namespace
Classes: ArticleHandler, BlogPostHandler, NewsHandler
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PostManager.
3
4
5
6
|
# File 'app/services/post_manager.rb', line 3
def initialize(entity)
@entity = entity
@body = entity.body.to_s
end
|
Class Method Details
.handler(entity) ⇒ Object
9
10
11
12
13
|
# File 'app/services/post_manager.rb', line 9
def self.handler(entity)
handler_name = "post_manager/#{entity.post_type.slug}_handler".classify
handler_class = handler_name.safe_constantize || PostManager
handler_class.new(entity)
end
|
Instance Method Details
#category_path(category) ⇒ Object
28
29
30
|
# File 'app/services/post_manager.rb', line 28
def category_path(category)
"posts/#{category.long_slug}"
end
|
#edit_path ⇒ Object
23
24
25
|
# File 'app/services/post_manager.rb', line 23
def edit_path
"/posts/#{@entity.id}/edit"
end
|
#parsed_body ⇒ Object
15
16
17
|
# File 'app/services/post_manager.rb', line 15
def parsed_body
@body.gsub(/<script/, '<script')
end
|
#post_path ⇒ Object
19
20
21
|
# File 'app/services/post_manager.rb', line 19
def post_path
"/posts/#{@entity.id}"
end
|