Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming/MethodParameterName AllowedNames support for as #10960

Closed
bkuhlmann opened this issue Aug 24, 2022 · 1 comment
Closed

Naming/MethodParameterName AllowedNames support for as #10960

bkuhlmann opened this issue Aug 24, 2022 · 1 comment

Comments

@bkuhlmann
Copy link

Describe the solution you'd like

This is a small request for adding as to the default list of AllowedNames.

Describe alternatives you've considered

The alternative is to manage my own list of allowed names. Example:

Naming/MethodParameterName:
  AllowedNames:
    - as
    - at
    - by
    - db
    - id
    - in
    - io
    - ip
    - of
    - on
    - os
    - pp
    - to

Notice that I include as in the list above which is the only exception to the current defaults.

Additional context

I often find that I'm using as as a parameter for functional composition in Ruby where I need to have a parameter that allows me to message an object as a different representation of itself after being operated on. Example (truncated for brevity):

use my_command, as: :to_h

The above allows me to delegate to my_command with a #call message which answers an object that can be converted to a hash via the as: :to_h parameter. The use of the as parameter allows me to have short and succinct syntax for pulling this off.

@koic
Copy link
Member

koic commented Aug 24, 2022

That makes sense. e2c1298 has updated this default configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants