Skip to content

Rename local variable include#944

Merged
lgebhardt merged 3 commits intoJSONAPI-Resources:masterfrom
olleolleolle:fix/rename-local-variable
Dec 23, 2016
Merged

Rename local variable include#944
lgebhardt merged 3 commits intoJSONAPI-Resources:masterfrom
olleolleolle:fix/rename-local-variable

Conversation

@olleolleolle
Copy link
Copy Markdown
Contributor

@olleolleolle olleolleolle commented Dec 23, 2016

This PR renames a local variable in one of the methods concerning includes, the JSONAPI concept.

This avoids collision with the Ruby keyword, which can be confusing for the reader.

(Also: use #map to create a list.)

(I came to read #937 and was a little confused, at first.)

  - this avoids collision with a keyword, which can be confusing
Comment thread lib/jsonapi/request_parser.rb Outdated

def parse_include_directives(include)
return if include.nil?
def parse_include_directives(include_directives)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name include_directives might be confused with the parsed @include_directives. Maybe rename to raw_include, include_param or something similar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will edit right now.

@olleolleolle
Copy link
Copy Markdown
Contributor Author

@lgebhardt There. The raw_ prefix indicates "user input".

@olleolleolle
Copy link
Copy Markdown
Contributor Author

olleolleolle commented Dec 23, 2016

I also note that we'd be better off doing return unless raw_include since

CSV.parse_line(false) would raise an error.

@lgebhardt lgebhardt merged commit 34b1fc5 into JSONAPI-Resources:master Dec 23, 2016
@olleolleolle olleolleolle deleted the fix/rename-local-variable branch December 23, 2016 14:26
@lgebhardt
Copy link
Copy Markdown
Contributor

@olleolleolle Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants