Skip to content

Files

Latest commit

 

History

History
34 lines (22 loc) · 571 Bytes

Style-OptionHash.md

File metadata and controls

34 lines (22 loc) · 571 Bytes

Pattern: Use of options hash

Issue: -

Description

This rule checks for options hashes and discourages them if the current Ruby version supports keyword arguments.

Examples

Instead of:

def fry(options = {})
  temperature = options.fetch(:temperature, 300)
  ...
end

Prefer:

def fry(temperature: 300)
  ...
end

Default configuration

Attribute Value
SuspiciousParamNames options, opts, args, params, parameters

Further Reading