Skip to content

Commit 6ce174a

Browse files
committed
Remove deprecated API of positional arguments
1 parent 090091b commit 6ce174a

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

lib/css_parser/parser.rb

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -410,17 +410,11 @@ def compact! # :nodoc:
410410
# See add_block! for options.
411411
#
412412
# Deprecated: originally accepted three params: `uri`, `base_uri` and `media_types`
413-
def load_uri!(uri, options = {}, deprecated = nil)
413+
def load_uri!(uri, options = {})
414414
uri = Addressable::URI.parse(uri) unless uri.respond_to? :scheme
415415

416416
opts = {base_uri: nil, media_types: :all}
417-
418-
if options.is_a? Hash
419-
opts.merge!(options)
420-
else
421-
opts[:base_uri] = options if options.is_a? String
422-
opts[:media_types] = deprecated if deprecated
423-
end
417+
opts.merge!(options)
424418

425419
if uri.scheme == 'file' or uri.scheme.nil?
426420
uri.path = File.expand_path(uri.path)
@@ -438,15 +432,9 @@ def load_uri!(uri, options = {}, deprecated = nil)
438432
end
439433

440434
# Load a local CSS file.
441-
def load_file!(file_name, options = {}, deprecated = nil)
435+
def load_file!(file_name, options = {})
442436
opts = {base_dir: nil, media_types: :all}
443-
444-
if options.is_a? Hash
445-
opts.merge!(options)
446-
else
447-
opts[:base_dir] = options if options.is_a? String
448-
opts[:media_types] = deprecated if deprecated
449-
end
437+
opts.merge!(options)
450438

451439
file_path = @options[:file_resource]
452440
.find_file(file_name, base_dir: opts[:base_dir])
@@ -462,15 +450,9 @@ def load_file!(file_name, options = {}, deprecated = nil)
462450
end
463451

464452
# Load a local CSS string.
465-
def load_string!(src, options = {}, deprecated = nil)
453+
def load_string!(src, options = {})
466454
opts = {base_dir: nil, media_types: :all}
467-
468-
if options.is_a? Hash
469-
opts.merge!(options)
470-
else
471-
opts[:base_dir] = options if options.is_a? String
472-
opts[:media_types] = deprecated if deprecated
473-
end
455+
opts.merge!(options)
474456

475457
add_block!(src, opts)
476458
end

test/test_css_parser_loading.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_loading_a_string
7777

7878
def test_following_at_import_rules_local
7979
base_dir = File.expand_path('fixtures', __dir__)
80-
@cp.load_file!('import1.css', base_dir)
80+
@cp.load_file!('import1.css', base_dir: base_dir)
8181

8282
# from '/import1.css'
8383
assert_equal 'color: lime;', @cp.find_by_selector('div').join(' ')

0 commit comments

Comments
 (0)