Sha256: 8e8d595b54ac5102d3e94163bab45bfa0ba041d3bcc8f1ee2809c2f75fb98fa2
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
module PrLog # Format new pull requests from github search response class Formatter pattr_initialize :pull_requests, :entry_template, :label_prefixes def entries return '' if pull_requests.empty? pull_requests.map { |pull_request| entry_template % entry_template_data(pull_request) }.join.prepend("\n") end private def entry_template_data(pull_request) pull_request.merge(title: prefixed_title(pull_request)) end def prefixed_title(pull_request) [label_prefix(pull_request), format_title(pull_request)].compact.join(' ') end def label_prefix(pull_request) pull_request.fetch(:labels, []).map { |label| label_prefixes[label[:name].to_s] }.compact.first end def format_title(pull_request) pull_request[:title] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pr_log-0.2.0 | lib/pr_log/formatter.rb |