Sha256: b3fab96c4e9fec9592aa6b8c6397c8887e9381c3c906562defae07acc959b291

Contents?: true

Size: 473 Bytes

Versions: 12

Compression:

Stored size: 473 Bytes

Contents

module Trackman
  module Urls
    module CssParser
      @@url ||= /url\(['"]?([^'"\)]+)['"]?\)/
      @@import ||= /url\(['"]?[^'"\)]+['"]?\)/
      
      def parse_css value
        value = value.dup
        clean_comments value
        value.scan(@@import).collect{|x| @@url.match(x)[1]}.select{|x| !x.embedded? }
      end

      def clean_comments value
        value.gsub!(/\/\*.*\*\//m, '')
        value.gsub!(/\<\!\-\-.*\-\-\>/m, '')
      end
    end
  end
end 

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
trackman-0.6.18 lib/trackman/urls/css_parser.rb
trackman-0.6.17 lib/trackman/urls/css_parser.rb
trackman-0.6.16 lib/trackman/urls/css_parser.rb
trackman-0.6.15 lib/trackman/urls/css_parser.rb
trackman-0.6.14 lib/trackman/urls/css_parser.rb
trackman-0.6.13 lib/trackman/urls/css_parser.rb
trackman-0.6.12 lib/trackman/urls/css_parser.rb
trackman-0.6.11 lib/trackman/urls/css_parser.rb
trackman-0.6.10 lib/trackman/urls/css_parser.rb
trackman-0.6.9 lib/trackman/urls/css_parser.rb
trackman-0.6.8 lib/trackman/urls/css_parser.rb
trackman-0.6.7 lib/trackman/urls/css_parser.rb