-
Notifications
You must be signed in to change notification settings - Fork 72
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
Refactor configurations #34
Conversation
Since Rails 4.2 YAML configuration files can be easily loaded with the new config_for
occured with: RUBYOPT="-w" bundle exec rspec spec message `warning: character class has duplicated range`
@@ -11,8 +11,7 @@ def execute | |||
end | |||
|
|||
def auto_skip_error? | |||
return @auto_skip_error if defined? @auto_skip_error | |||
@auto_skip_error = option ? TRUE_OPTIONS.include?(option.strip) : false | |||
@auto_skip_error ||= option ? TRUE_OPTIONS.include?(option.strip) : false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@auto_skip_error
was already memoized, but this change breaks the memoization.
When option
or TRUE_OPTIONS.include?(option.strip)
is evaluated to false, @auto_skip_error ||= expr
is evaluated every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When option or TRUE_OPTIONS.include?(option.strip) is evaluated to false, @auto_skip_error ||= expr is evaluated every time.
Thank you for reviewing!
I'll remove the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
config_for
method to load configuration files easily. The method supported after Rails version 4.2.RUBYOPT="-w"
option.[\w_-]
has a duplicate character range between\w
and_
.Memoized instance valiable:@auto_skip_error