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

compute_asset_extname should explicitly return nil in else clause #27665

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

kenta-s
Copy link
Contributor

@kenta-s kenta-s commented Jan 13, 2017

As is

# Compute extname to append to asset path. Returns +nil+ if
# nothing should be added.
def compute_asset_extname(source, options = {})
  
  return if options[:extname] == false
  
  extname = options[:extname] || ASSET_EXTENSIONS[options[:type]]
  
  extname if extname && File.extname(source) != extname
end
end

Nothing specified as a return value when the last condition is false. An else clause should be here and explicitly return nil.


@kenta-s kenta-s changed the title compute_asset_extname should explicitly returns nil in else clause compute_asset_extname should explicitly return nil in else clause Jan 14, 2017
@rafaelfranca rafaelfranca merged commit 1263478 into rails:master Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants