Module: NotifierHelper

Defined in:
app/helpers/notifier_helper.rb

Instance Method Summary collapse

Instance Method Details

#comment_message(comment, opts = {}) ⇒ String

Returns The truncated and formatted comment.

Parameters:

  • comment (Comment)

    The comment to process.

  • opts (Hash) (defaults to: {})

    Optional hash. Accepts :length parameters.

Returns:

  • (String)

    The truncated and formatted comment.


17
18
19
# File 'app/helpers/notifier_helper.rb', line 17

def comment_message(comment, opts={})
  comment.message.plain_text_without_markdown truncate: opts.fetch(:length, 600)
end

#post_message(post, opts = {}) ⇒ String

Returns The truncated and formatted post.

Parameters:

  • post (Post)

    The post object.

  • opts (Hash) (defaults to: {})

    Optional hash. Accepts :length parameters.

Returns:

  • (String)

    The truncated and formatted post.


6
7
8
9
10
11
12
# File 'app/helpers/notifier_helper.rb', line 6

def post_message(post, opts={})
  if post.respond_to? :message
    post.message.plain_text_without_markdown truncate: opts.fetch(:length, 200)
  else
    I18n.translate 'notifier.a_post_you_shared'
  end
end