Class: Flickry::Comment

Inherits:
String
  • Object
show all
Defined in:
lib/flickry/comment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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.author
  @authorname = comment.authorname
  @datecreate = comment.datecreate
  @permalink = comment.permalink
end

Instance Attribute Details

#author_idObject (readonly)

Returns the value of attribute author_id.



3
4
5
# File 'lib/flickry/comment.rb', line 3

def author_id
  @author_id
end

#authornameObject (readonly)

Returns the value of attribute authorname.



3
4
5
# File 'lib/flickry/comment.rb', line 3

def authorname
  @authorname
end

#comment_idObject (readonly)

Returns the value of attribute comment_id.



3
4
5
# File 'lib/flickry/comment.rb', line 3

def comment_id
  @comment_id
end

#datecreateObject (readonly)

Returns the value of attribute datecreate.



3
4
5
# File 'lib/flickry/comment.rb', line 3

def datecreate
  @datecreate
end

Returns the value of attribute permalink.



3
4
5
# File 'lib/flickry/comment.rb', line 3

def permalink
  @permalink
end

Instance Method Details

#authorObject

Get a Person record for the author_id



19
20
21
# File 'lib/flickry/comment.rb', line 19

def author
  Flickry::Person.find(@author_id)
end

#created_atObject

datecreate converted into Time object



14
15
16
# File 'lib/flickry/comment.rb', line 14

def created_at
  Time.at(@datecreate.to_i)
end

#nameObject

name = authornane



24
25
26
# File 'lib/flickry/comment.rb', line 24

def name
  @authorname
end