Class: Flickry::Comment
- Inherits:
-
Base
- Object
- OpenStruct
- SuperStruct
- Base
- Flickry::Comment
- Defined in:
- lib/flickry/comment.rb
Instance Method Summary collapse
-
#author ⇒ Object
Get a Person record for the author_id.
- #comment_id ⇒ Object
-
#created_at ⇒ Object
datecreate converted into Time object.
-
#initialize(comment) ⇒ Comment
constructor
A new instance of Comment.
-
#name ⇒ Object
name = authornane.
- #to_s ⇒ Object
-
#to_url ⇒ Object
Clean permalink.
Methods inherited from Base
Methods inherited from SuperStruct
#[], #[]=, #each, #each_pair, #members
Constructor Details
#initialize(comment) ⇒ Comment
Returns a new instance of Comment.
3 4 5 6 7 8 9 |
# File 'lib/flickry/comment.rb', line 3 def initialize(comment) super(nil) @comment_id = comment.id extract_attrs!(comment, [:authorname, :datecreate, :permalink]) self.content = comment.to_s self. = comment. end |
Instance Method Details
#author ⇒ Object
Get a Person record for the author_id
30 31 32 |
# File 'lib/flickry/comment.rb', line 30 def Flickry::Person.find(self.) end |
#comment_id ⇒ Object
11 12 13 |
# File 'lib/flickry/comment.rb', line 11 def comment_id @comment_id end |
#created_at ⇒ Object
datecreate converted into Time object
25 26 27 |
# File 'lib/flickry/comment.rb', line 25 def created_at Time.at(self.datecreate.to_i) end |
#name ⇒ Object
name = authornane
35 36 37 |
# File 'lib/flickry/comment.rb', line 35 def name self. end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/flickry/comment.rb', line 15 def to_s self.content end |
#to_url ⇒ Object
Clean permalink
20 21 22 |
# File 'lib/flickry/comment.rb', line 20 def to_url clean(self.permalink) end |