Class: Nelumba::Comment
- Inherits:
-
Object
- Object
- Nelumba::Comment
- Includes:
- Object
- Defined in:
- lib/nelumba/comment.rb
Constant Summary
Constants included from Object
Object::USERNAME_REGULAR_EXPRESSION
Instance Attribute Summary collapse
-
#in_reply_to ⇒ Object
readonly
Holds a collection of Nelumba::Activity’s that this comment is in reply to.
Attributes included from Object
#author, #content, #display_name, #html, #image, #published, #summary, #text, #title, #uid, #updated, #url
Instance Method Summary collapse
- #init(options = {}, &blk) ⇒ Object
-
#initialize(options = {}, &blk) ⇒ Comment
constructor
Create a new Comment activity object.
-
#to_hash ⇒ Object
Returns a Hash representing this comment.
-
#to_json_hash ⇒ Object
Returns a Hash representing this comment with JSON ActivityStreams conventions.
Methods included from Object
#mentions, #reply_to, #to_as1, #to_html, #to_json, #to_text
Constructor Details
#initialize(options = {}, &blk) ⇒ Comment
Create a new Comment activity object.
options:
:content => The body of the comment in HTML.
:author => A Nelumba::Person that created the object.
:display_name => A natural-language, human-readable and plain-text name
for the comment.
:summary => Natural-language summarization of the comment.
:url => The canonical url of this comment.
:uid => The unique id that identifies this comment.
:image =>
:published => The Time when this comment was originally published.
:updated => The Time when this comment was last modified.
21 22 23 |
# File 'lib/nelumba/comment.rb', line 21 def initialize( = {}, &blk) init(, &blk) end |
Instance Attribute Details
#in_reply_to ⇒ Object (readonly)
Holds a collection of Nelumba::Activity’s that this comment is in reply to.
6 7 8 |
# File 'lib/nelumba/comment.rb', line 6 def in_reply_to @in_reply_to end |
Instance Method Details
#init(options = {}, &blk) ⇒ Object
25 26 27 28 29 |
# File 'lib/nelumba/comment.rb', line 25 def init( = {}, &blk) @in_reply_to = [:in_reply_to] || [] super end |
#to_hash ⇒ Object
Returns a Hash representing this comment.
32 33 34 35 36 |
# File 'lib/nelumba/comment.rb', line 32 def to_hash { :in_reply_to => @in_reply_to }.merge(super) end |
#to_json_hash ⇒ Object
Returns a Hash representing this comment with JSON ActivityStreams conventions.
40 41 42 43 44 45 |
# File 'lib/nelumba/comment.rb', line 40 def to_json_hash { :objectType => "comment", :in_reply_to => @in_reply_to }.merge(super) end |