spdx_alt_segments

in lib/licensee/license.rb [272:283]


    def spdx_alt_segments
      @spdx_alt_segments ||= begin
        path = File.expand_path "#{spdx_id}.xml", Licensee::License.spdx_dir
        raw_xml = File.read(path, encoding: 'utf-8')
        text = raw_xml.match(%r{<text>(.*)</text>}m)[1]
        text.gsub!(%r{<copyrightText>.*?</copyrightText>}m, '')
        text.gsub!(%r{<titleText>.*?</titleText>}m, '')
        text.gsub!(%r{<optional.*?>.*?</optional>}m, '')
        text.scan(/<alt .*?>/m).size
      end
    end