Class: NoteSummary
- Inherits:
-
Object
- Object
- NoteSummary
- Defined in:
- app/services/note_summary.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
Instance Method Summary collapse
-
#initialize(noteable, project, author, body, action: nil, commit_count: nil, created_at: nil) ⇒ NoteSummary
constructor
A new instance of NoteSummary.
- #metadata? ⇒ Boolean
- #set_commit_params ⇒ Object
Constructor Details
#initialize(noteable, project, author, body, action: nil, commit_count: nil, created_at: nil) ⇒ NoteSummary
Returns a new instance of NoteSummary.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/note_summary.rb', line 7 def initialize(noteable, project, , body, action: nil, commit_count: nil, created_at: nil) @note = { noteable: noteable, created_at: created_at || noteable., project: project, author: , note: body } @metadata = { action: action, commit_count: commit_count }.compact if action == 'description' && noteable.saved_description_version @metadata[:description_version] = noteable.saved_description_version end set_commit_params if note[:noteable].is_a?(Commit) end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'app/services/note_summary.rb', line 5 def @metadata end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
4 5 6 |
# File 'app/services/note_summary.rb', line 4 def note @note end |
Instance Method Details
#metadata? ⇒ Boolean
20 21 22 |
# File 'app/services/note_summary.rb', line 20 def .present? end |
#set_commit_params ⇒ Object
24 25 26 27 |
# File 'app/services/note_summary.rb', line 24 def set_commit_params note.merge!(noteable_type: 'Commit', commit_id: note[:noteable].id) note[:noteable] = nil end |