class Thredded::PushoverNotifier::ContentHelper

Attributes

post[R]
root_url[R]

Public Class Methods

new(root_url, post) click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 13
def initialize(root_url, post)
  @root_url = root_url
  @post = post
end

Public Instance Methods

message_for_new_topic_post() click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 18
def message_for_new_topic_post
  content_truncated(replace_images)
end
post_url() click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 26
def post_url
  "#{root_url}#{post_permalink_path(post.id)}"
end
title_for_new_topic_post() click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 22
def title_for_new_topic_post
  "#{post.postable.title} by @#{post.user.thredded_display_name} [#{post.messageboard.name}]"
end

Protected Instance Methods

content_truncated(content) click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 36
def content_truncated(content)
  truncate(content, length: 100, separator: ' ')
end
replace_images() click to toggle source
# File lib/thredded/pushover_notifier/content_helper.rb, line 32
def replace_images
  post.content.gsub(/!\[[^\]]*?\]\(([^)]*?)\)/, '[IMAGE]')
end