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 |
# File 'lib/flickry/comment.rb', line 3 def initialize(comment) super(nil) extract_attrs!(comment, [:fid, :authorname, :datecreate, :permalink]) self.content = comment.to_s self. = comment. end |
Instance Method Details
#author ⇒ Object
Get a Person record for the author_id
29 30 31 |
# File 'lib/flickry/comment.rb', line 29 def Flickry::Person.find(self.) end |
#comment_id ⇒ Object
10 11 12 |
# File 'lib/flickry/comment.rb', line 10 def comment_id self.fid end |
#created_at ⇒ Object
datecreate converted into Time object
24 25 26 |
# File 'lib/flickry/comment.rb', line 24 def created_at Time.at(self.datecreate.to_i) end |
#name ⇒ Object
name = authornane
34 35 36 |
# File 'lib/flickry/comment.rb', line 34 def name self. end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/flickry/comment.rb', line 14 def to_s self.content end |
#to_url ⇒ Object
Clean permalink
19 20 21 |
# File 'lib/flickry/comment.rb', line 19 def to_url clean(self.permalink) end |