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

Refactor configurations #34

Merged
merged 2 commits into from
Jan 5, 2017
Merged

Refactor configurations #34

merged 2 commits into from
Jan 5, 2017

Conversation

iguchi1124
Copy link
Contributor

@iguchi1124 iguchi1124 commented Dec 30, 2016

Changes

  • I'd prefer to use config_for method to load configuration files easily. The method supported after Rails version 4.2.
  • Removed a warning message that occured with runnning app with RUBYOPT="-w" option.
    • [\w_-] has a duplicate character range between \w and _ .
  • Memoized instance valiable: @auto_skip_error

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@eagletmt eagletmt left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@eisuke eisuke left a comment

Choose a reason for hiding this comment

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

LGTM

@eisuke eisuke merged commit ff964f4 into cookpad:master Jan 5, 2017
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.

3 participants