Class: Flickry::Comment
- Inherits:
-
String
- Object
- String
- Flickry::Comment
- Defined in:
- lib/flickry/comment.rb
Instance Attribute Summary collapse
-
#author_id ⇒ Object
readonly
Returns the value of attribute author_id.
-
#authorname ⇒ Object
readonly
Returns the value of attribute authorname.
-
#comment_id ⇒ Object
readonly
Returns the value of attribute comment_id.
-
#datecreate ⇒ Object
readonly
Returns the value of attribute datecreate.
-
#permalink ⇒ Object
readonly
Returns the value of attribute permalink.
Instance Method Summary collapse
-
#author ⇒ Object
Get a Person record for the author_id.
-
#created_at ⇒ Object
datecreate converted into Time object.
-
#initialize(comment) ⇒ Comment
constructor
A new instance of Comment.
-
#name ⇒ Object
name = authornane.
Constructor Details
#initialize(comment) ⇒ Comment
Returns a new instance of Comment.
4 5 6 7 8 9 10 11 |
# File 'lib/flickry/comment.rb', line 4 def initialize(comment) super(comment.to_s) @comment_id = comment.id @author_id = comment. @authorname = comment. @datecreate = comment.datecreate @permalink = comment.permalink end |
Instance Attribute Details
#author_id ⇒ Object (readonly)
Returns the value of attribute author_id.
3 4 5 |
# File 'lib/flickry/comment.rb', line 3 def @author_id end |
#authorname ⇒ Object (readonly)
Returns the value of attribute authorname.
3 4 5 |
# File 'lib/flickry/comment.rb', line 3 def @authorname end |
#comment_id ⇒ Object (readonly)
Returns the value of attribute comment_id.
3 4 5 |
# File 'lib/flickry/comment.rb', line 3 def comment_id @comment_id end |
#datecreate ⇒ Object (readonly)
Returns the value of attribute datecreate.
3 4 5 |
# File 'lib/flickry/comment.rb', line 3 def datecreate @datecreate end |
#permalink ⇒ Object (readonly)
Returns the value of attribute permalink.
3 4 5 |
# File 'lib/flickry/comment.rb', line 3 def permalink @permalink end |
Instance Method Details
#author ⇒ Object
Get a Person record for the author_id
19 20 21 |
# File 'lib/flickry/comment.rb', line 19 def Flickry::Person.find(@author_id) end |
#created_at ⇒ Object
datecreate converted into Time object
14 15 16 |
# File 'lib/flickry/comment.rb', line 14 def created_at Time.at(@datecreate.to_i) end |
#name ⇒ Object
name = authornane
24 25 26 |
# File 'lib/flickry/comment.rb', line 24 def name @authorname end |