Class: Reviewable::Conversation
- Inherits:
-
Object
- Object
- Reviewable::Conversation
- Includes:
- ActiveModel::Serialization
- Defined in:
- lib/reviewable/conversation.rb
Defined Under Namespace
Classes: Post
Instance Attribute Summary collapse
-
#conversation_posts ⇒ Object
readonly
Returns the value of attribute conversation_posts.
-
#has_more ⇒ Object
readonly
Returns the value of attribute has_more.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#permalink ⇒ Object
readonly
Returns the value of attribute permalink.
Instance Method Summary collapse
-
#initialize(meta_topic) ⇒ Conversation
constructor
A new instance of Conversation.
Constructor Details
#initialize(meta_topic) ⇒ Conversation
Returns a new instance of Conversation.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/reviewable/conversation.rb', line 30 def initialize() @id = .id @has_more = false @permalink = "#{Discourse.base_url_no_prefix}#{.relative_url}" @posts = [] = .ordered_posts.where(post_type: ::Post.types[:regular]).limit(2) @conversation_posts = .map { |mp| Reviewable::Conversation::Post.new(mp) } @has_more = .posts_count > 2 end |
Instance Attribute Details
#conversation_posts ⇒ Object (readonly)
Returns the value of attribute conversation_posts.
28 29 30 |
# File 'lib/reviewable/conversation.rb', line 28 def conversation_posts @conversation_posts end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
28 29 30 |
# File 'lib/reviewable/conversation.rb', line 28 def has_more @has_more end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28 29 30 |
# File 'lib/reviewable/conversation.rb', line 28 def id @id end |
#permalink ⇒ Object (readonly)
Returns the value of attribute permalink.
28 29 30 |
# File 'lib/reviewable/conversation.rb', line 28 def permalink @permalink end |