Class: HitorigotoReporter::Formatter
- Inherits:
-
Object
- Object
- HitorigotoReporter::Formatter
- Defined in:
- lib/hitorigoto_reporter/formatter.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(hitorigoto_list) ⇒ Formatter
constructor
A new instance of Formatter.
- #stamps ⇒ Object
- #to_markdown ⇒ Object
Constructor Details
#initialize(hitorigoto_list) ⇒ Formatter
Returns a new instance of Formatter.
3 4 5 |
# File 'lib/hitorigoto_reporter/formatter.rb', line 3 def initialize(hitorigoto_list) @hitorigoto_list = hitorigoto_list end |
Instance Method Details
#empty? ⇒ Boolean
7 8 9 |
# File 'lib/hitorigoto_reporter/formatter.rb', line 7 def empty? @hitorigoto_list.empty? end |
#stamps ⇒ Object
20 21 22 23 |
# File 'lib/hitorigoto_reporter/formatter.rb', line 20 def stamps filtered_list, file_comments = filter_list_and_extract_comments filtered_list.flat_map(&:stamps).uniq end |
#to_markdown ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/hitorigoto_reporter/formatter.rb', line 11 def to_markdown filtered_list, file_comments = filter_list_and_extract_comments filtered_list .reverse .map { |h| "### #{h.username} at [#{h.created_at.strftime('%T')}](#{h.permalink})\n#{format_body(h.text, file_comments)}" } .join("\n\n\n") end |