Class: Faun::Comment
- Inherits:
-
Object
- Object
- Faun::Comment
- Defined in:
- lib/faun.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id, author, created, content) ⇒ Comment
constructor
A new instance of Comment.
- #markdown_content ⇒ Object
- #to_json(*args) ⇒ Object
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, , created, content) @id = id @author = @created = created @content = content end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
239 240 241 |
# File 'lib/faun.rb', line 239 def @author end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
239 240 241 |
# File 'lib/faun.rb', line 239 def content @content end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
239 240 241 |
# File 'lib/faun.rb', line 239 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
239 240 241 |
# File 'lib/faun.rb', line 239 def id @id end |
Instance Method Details
#markdown_content ⇒ Object
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 |