lib/css_parser/parser.rb in css_parser-1.4.8 vs lib/css_parser/parser.rb in css_parser-1.4.9
- old
+ new
@@ -18,11 +18,11 @@
STRIP_CSS_COMMENTS_RX = /\/\*.*?\*\//m
STRIP_HTML_COMMENTS_RX = /\<\!\-\-|\-\-\>/m
# Initial parsing
- RE_AT_IMPORT_RULE = /\@import\s*(?:url\s*)?(?:\()?(?:\s*)["']?([^'"\s\)]*)["']?\)?([\w\s\,^\]\(\))]*)\)?[;\n]?/
+ RE_AT_IMPORT_RULE = /\@import\s*(?:url\s*)?(?:\()?(?:\s*)["']?([^'"\s\)]*)["']?\)?([\w\s\,^\]\(\)]*)\)?[;\n]?/
MAX_REDIRECTS = 3
# Array of CSS files that have been loaded.
attr_reader :loaded_uris
@@ -186,14 +186,14 @@
end
end
end
# Output all CSS rules as a Hash
- def to_h(media_types = :all)
+ def to_h(which_media = :all)
out = {}
styles_by_media_types = {}
- each_selector(media_types) do |selectors, declarations, specificity, media_types|
+ each_selector(which_media) do |selectors, declarations, specificity, media_types|
media_types.each do |media_type|
styles_by_media_types[media_type] ||= []
styles_by_media_types[media_type] << [selectors, declarations]
end
end
@@ -219,14 +219,14 @@
end
end
end
# Output all CSS rules as a single stylesheet.
- def to_s(media_types = :all)
+ def to_s(which_media = :all)
out = ''
styles_by_media_types = {}
- each_selector(media_types) do |selectors, declarations, specificity, media_types|
+ each_selector(which_media) do |selectors, declarations, specificity, media_types|
media_types.each do |media_type|
styles_by_media_types[media_type] ||= []
styles_by_media_types[media_type] << [selectors, declarations]
end
end
@@ -509,11 +509,11 @@
if res.code.to_i >= 400
@redirect_count = nil
raise RemoteFileError if @options[:io_exceptions]
return '', nil
elsif res.code.to_i >= 300 and res.code.to_i < 400
- if res.response['Location'] != nil
- return read_remote_file Addressable::URI.parse(URI.escape(res.response['Location']))
+ if res['Location'] != nil
+ return read_remote_file Addressable::URI.parse(Addressable::URI.escape(res['Location']))
end
end
case res['content-encoding']
when 'gzip'