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

Enable block variable in view #27303

Merged
merged 2 commits into from Dec 8, 2016
Merged

Conversation

@toshimaru
Copy link
Contributor

@toshimaru toshimaru commented Dec 8, 2016

Summary

Enabling block variable in view.

This fixes #27302

@rails-bot
Copy link

@rails-bot rails-bot commented Dec 8, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @senny (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

Loading

@matthewd
Copy link
Member

@matthewd matthewd commented Dec 8, 2016

Instead of excluding the one value here, let's split DELEGATION_RESERVED_METHOD_NAMES in half, between the real keywords (most of them), and the couple (including block) that are just reserved in delegate because they're used in the implementation.

Loading

RUBY_RESERVED_KEYWORDS = %w(alias and BEGIN begin break case class def defined? do
else elsif END end ensure false for if in module next nil not or redo rescue retry
return self super then true undef unless until when while yield)
DELEGATION_RESERVED_KEYWORDS = %w(_ arg args block)
Copy link
Contributor Author

@toshimaru toshimaru Dec 8, 2016

Choose a reason for hiding this comment

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

I extracted only delegation reserved keywords like this:

$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]

$ cat extract_keywords.rb
original_keywords = %w(_ arg args alias and BEGIN begin block break case class def defined? do else elsif END end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield)
keywords = []

original_keywords.each do |keyword|
  begin
    eval("#{keyword} = 1")
  rescue SyntaxError => e
    keywords << keyword
  end
end

p keywords
p original_keywords - keywords

$ ruby extract_keywords.rb
["alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "nil", "not", "or", "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", "until", "when", "while", "yield"]
["_", "arg", "args", "block"]

Loading

@@ -6,11 +6,12 @@ class Module
# option is not used.
class DelegationError < NoMethodError; end

RUBY_RESERVED_KEYWORDS = %w(alias and BEGIN begin break case class def defined? do
Copy link
Contributor Author

@toshimaru toshimaru Dec 8, 2016

Choose a reason for hiding this comment

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

Not sure the constant naming and defined location are good.

@matthewd What do you think?

Loading

@toshimaru toshimaru force-pushed the fix/partial-variable-block branch from 2e5ac83 to d9ff835 Dec 8, 2016
@matthewd matthewd merged commit 81608cd into rails:master Dec 8, 2016
1 of 2 checks passed
Loading
matthewd added a commit that referenced this issue Dec 8, 2016
@matthewd
Copy link
Member

@matthewd matthewd commented Dec 8, 2016

96f0df1

Loading

@toshimaru toshimaru deleted the fix/partial-variable-block branch Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants