class Ravelry::Comment

The information used to create `Ravelry::Comment` comes from {Ravelry::Pattern} objects.

You should not create `Comment` objects manually; they are all created–and owned by–by a {Ravelry::Pattern}.

See {Ravelry::Pattern} for more information about `Pattern` objects.

Attributes

highlighted_project[R]
html[R]
id[R]
user[R]

Public Class Methods

new(data) click to toggle source

Creates new `Comment` from Ravelry API Pattern Comment attributes.

All class variables are readonly.

# File lib/ravelry/comment.rb, line 16
def initialize(data)
  @data = data
  @user = Ravelry::User.new
  @user.data = data[:user]
  @highlighted_project = data[:highlighted_project]      
  @html = data[:html]
  @id = data[:id]
end

Public Instance Methods

replies() click to toggle source
# File lib/ravelry/comment.rb, line 25
def replies
  @reply_list ||= []
  return @reply_list if @reply_list.any?
  @data[:replies].map do |reply|
    @reply_list << Ravelry::Comment.new(reply)
  end
end