Class: Faun::Comment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, author, created, content) ⇒ Comment

Returns a new instance of Comment.



241
242
243
244
245
246
# File 'lib/faun.rb', line 241

def initialize(id, author, created, content)
  @id = id
  @author = author
  @created = created
  @content = content
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



239
240
241
# File 'lib/faun.rb', line 239

def author
  @author
end

#contentObject (readonly)

Returns the value of attribute content.



239
240
241
# File 'lib/faun.rb', line 239

def content
  @content
end

#createdObject (readonly)

Returns the value of attribute created.



239
240
241
# File 'lib/faun.rb', line 239

def created
  @created
end

#idObject (readonly)

Returns the value of attribute id.



239
240
241
# File 'lib/faun.rb', line 239

def id
  @id
end

Instance Method Details

#markdown_contentObject



248
249
250
# File 'lib/faun.rb', line 248

def markdown_content
  Kramdown::Document.new(@content).to_html
end

#to_json(*args) ⇒ Object



252
253
254
255
256
257
258
259
# File 'lib/faun.rb', line 252

def to_json(*args)
  {
    :id => id,
    :author => @author,
    :created => @created,
    :content => @content
  }.to_json
end