Skip to content

Commit

Permalink
Warn uses of deprecated use of load_uri! load_file!, load_string!
Browse files Browse the repository at this point in the history
  • Loading branch information
stoivo committed Jun 12, 2024
1 parent 6b3cca7 commit f8facbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Unreleased

* Deprecate `load_uri!`, `load_file!` and `load_string!` positional arguments over keyword argument
* Deprecate `add_rule!` (positional arguments)and `add_rule_with_offsets!` for `add_rule!` (keyword argument)
* RuleSet initialize now takes keyword argument, positional arguments are still supported but deprecated
* Removed OffsetAwareRuleSet, it's a RuleSet with optional attributes filename and offset
Expand Down
6 changes: 6 additions & 0 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ def load_uri!(uri, options = {}, deprecated = nil)
if options.is_a? Hash
opts.merge!(options)
else
warn '[DEPRECATION] `load_uri!` with positional arguments is deprecated. ' \
'Please use keyword arguments instead.', uplevel: 1
opts[:base_uri] = options if options.is_a? String
opts[:media_types] = deprecated if deprecated
end
Expand All @@ -517,6 +519,8 @@ def load_file!(file_name, options = {}, deprecated = nil)
if options.is_a? Hash
opts.merge!(options)
else
warn '[DEPRECATION] `load_file!` with positional arguments is deprecated. ' \
'Please use keyword arguments instead.', uplevel: 1
opts[:base_dir] = options if options.is_a? String
opts[:media_types] = deprecated if deprecated
end
Expand All @@ -540,6 +544,8 @@ def load_string!(src, options = {}, deprecated = nil)
if options.is_a? Hash
opts.merge!(options)
else
warn '[DEPRECATION] `load_file!` with positional arguments is deprecated. ' \
'Please use keyword arguments instead.', uplevel: 1
opts[:base_dir] = options if options.is_a? String
opts[:media_types] = deprecated if deprecated
end
Expand Down

0 comments on commit f8facbf

Please sign in to comment.