Sha256: 820427ca979ee9fa9df5143897f839e2c1394a8bc03efbbb6cd9c2a738e1bf9a
Contents?: true
Size: 1.31 KB
Versions: 6
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require "hanami/view" require "pathname" require "refinements/string" module Milestoner module Views module Milestones # Produces release notes in HTML format. class Show < Hanami::View using Refinements::String config.default_context = Context.new config.part_namespace = Parts config.paths = Container[:configuration].build_template_paths config.template = "milestones/show" expose :commits expose :uri, default: Container[:configuration].project_uri expose :at, default: Time.now.utc expose(:date) { |at| at.strftime "%Y-%m-%d" } expose(:datetime) { |at| at.strftime "%Y-%m-%dT%H:%M:%S%z" } expose :total_commits do |commits| total = commits.size "#{total} commit".pluralize "s", total end expose :total_files do |commits| total = commits.sum(&:files_changed) "#{total} file".pluralize "s", total end expose :total_deletions do |commits| total = commits.sum(&:deletions) "#{total} deletion".pluralize "s", total end expose :total_insertions do |commits| total = commits.sum(&:insertions) "#{total} insertion".pluralize "s", total end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems