Sha256: 8a93023ecf123ca5e8a38c95ffed4c234a7e6fd2a9d8c1b59ea4663bfd328dfc

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

require 'license_finder/reports/erb_report'

module LicenseFinder
  class JunitReport < ErbReport
    ROOT_PATH = Pathname.new(__FILE__).dirname
    TEMPLATE_PATH = ROOT_PATH.join('templates')

    def to_s(filename = TEMPLATE_PATH.join("#{template_name}.erb"))
      if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.6.0')
        template = ERB.new(filename.read, nil, '-')
      else
        template = ERB.new(filename.read, trim_mode: '-')
      end
      template.result(binding)
    end

    private

    def template_name
      'junit_report'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/reports/junit_report.rb
license_finder-7.0.1 lib/license_finder/reports/junit_report.rb
license_finder-7.0.0 lib/license_finder/reports/junit_report.rb