Sha256: fad64f19b0b32604a2213c50a3961e23da3a6c1cf3525a8de47a7ec0a9ab5d12

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

module Flickry
  class Comment < Flickry::Base
    def initialize(comment)
      super(nil)
      @comment_id = comment.id
      extract_attrs!(comment, [:authorname, :datecreate, :permalink])
      self.content = comment.to_s
      self.author_id = comment.author
    end
    
    def comment_id
      @comment_id
    end
    
    def to_s
      self.content
    end
    
    # Clean permalink
    def to_url
      clean(self.permalink)
    end
    
    # datecreate converted into Time object
    def created_at
      Time.at(self.datecreate.to_i)
    end
    
    # Get a Person record for the author_id
    def author
      Flickry::Person.find(self.author_id)
    end
    
    # name = authornane
    def name
      self.authorname
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wideopenspaces-flickry-0.1.6 lib/flickry/comment.rb