Skip to content

Commit

Permalink
Fix warning in Ruby 2.7+
Browse files Browse the repository at this point in the history
This fixes the following warning when creating your own transformer like so:

```ruby
class SomeTransformer
  def call(node:, **_)
    {
      node_allowlist: [node],
    }
  end
end
```

```
/usr/local/bundle/ruby/2.7.0/gems/sanitize-5.2.1/lib/sanitize.rb:207: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
```
  • Loading branch information
mscrivo committed Jan 6, 2021
1 parent b032474 commit 361cc05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sanitize.rb
Expand Up @@ -204,7 +204,7 @@ def transform_node!(node, node_allowlist)
config[:node_name] = node.name.downcase
config[:node_allowlist] = config[:node_whitelist] = node_allowlist

result = transformer.call(config)
result = transformer.call(**config)

if result.is_a?(Hash)
result_allowlist = result[:node_allowlist] || result[:node_whitelist]
Expand Down

0 comments on commit 361cc05

Please sign in to comment.