Class: Yapt::Comment

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Comment

Returns a new instance of Comment.



9
10
11
# File 'lib/yapt/comment.rb', line 9

def initialize(data)
  @raw = data
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



8
9
10
# File 'lib/yapt/comment.rb', line 8

def raw
  @raw
end

Class Method Details

.find(story_id) ⇒ Object



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

def self.find(story_id)
  results = Request.new("stories/#{story_id}/comments", {}, :get).result
  results.collect {|r| new(r) }
end

Instance Method Details

#commenterObject



20
21
22
# File 'lib/yapt/comment.rb', line 20

def commenter
  @commenter ||= Member.find(person_id)
end

#created_at_displayObject



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

def created_at_display
  time_display(created_at)
end

#time_display(time) ⇒ Object



28
29
30
# File 'lib/yapt/comment.rb', line 28

def time_display(time)
  Time.parse(time).strftime("%a %d %b %I:%M")
end