Sha256: 09e48de20d904c58e19d6da450324ee66243d419108cdea3b327b6fbe78d9ebc
Contents?: true
Size: 559 Bytes
Versions: 6
Compression:
Stored size: 559 Bytes
Contents
# frozen_string_literal: true module JsDependency module Extractor 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 # @param [String] str # @return [String] def self.call(str) new(str).call end end end end
Version data entries
6 entries across 6 versions & 1 rubygems