Sha256: 3e01d971bf7e36eccb2ffb28b7ed68eb0a27c95f1bfeace4e99f3b25dd19736d
Contents?: true
Size: 447 Bytes
Versions: 7
Compression:
Stored size: 447 Bytes
Contents
# frozen_string_literal: true module JsDependency class ExtractScriptTag # @param [String] str def initialize(str) @str = str end # @return [Array<String>] def call str = @str scripts = str.gsub(%r{<script>(.+)</script>}m).with_object([]) do |_, list| list << Regexp.last_match(1) end scripts.uniq.sort.join("\n") end def self.call(str) new(str).call end end end
Version data entries
7 entries across 7 versions & 1 rubygems