ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/services/offences_summary_service/collection.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
66%
class OffencesSummaryService
  class Collection
    include Enumerable

    def initialize(offences:, fee_schemes:)
      @rows = offences.map do |offence|
        Row.new(offence, fee_schemes:)
      end
      @fee_schemes = fee_schemes
    end

    def each(&) = @rows.each(&)

    def fee_scheme_headings = @fee_scheme_headings = @fee_schemes.map { |fs| format('%s %d', fs.name, fs.version) }
  end
end