Class: Gish::Comment
- Inherits:
-
Object
- Object
- Gish::Comment
- Includes:
- DateHelpers, TerminalHelpers
- Defined in:
- lib/gish/presentation/comment.rb
Constant Summary
Constants included from DateHelpers
DateHelpers::A_DAY, DateHelpers::A_MONTH, DateHelpers::A_YEAR
Instance Method Summary collapse
-
#initialize(github_comment) ⇒ Comment
constructor
A new instance of Comment.
- #to_s ⇒ Object
Methods included from DateHelpers
Methods included from TerminalHelpers
#bold, #console_width, #format_label, #underline
Constructor Details
#initialize(github_comment) ⇒ Comment
Returns a new instance of Comment.
6 7 8 9 10 11 |
# File 'lib/gish/presentation/comment.rb', line 6 def initialize(github_comment) @body = github_comment.body.gsub("\r\n", "\n") @user = github_comment.user.login @id = github_comment.id @created_at = time_in_words(github_comment.created_at) end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 |
# File 'lib/gish/presentation/comment.rb', line 13 def to_s output = "\n#{@id} #{bold(@user)} commented #{@created_at}" output << "\n\"#{@body}\"\n" output end |