-
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
RuboCop: Stage IV #171
base: master
Are you sure you want to change the base?
RuboCop: Stage IV #171
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,16 +30,14 @@ def initialize | |
end | ||
|
||
def asset_file=(custom_asset_file) | ||
begin | ||
method = custom_asset_file.method(:named) | ||
if method.arity == 1 | ||
@asset_file = custom_asset_file | ||
else | ||
raise InlineSvg::Configuration::Invalid.new("asset_file should implement the #named method with arity 1") | ||
end | ||
rescue NameError | ||
raise InlineSvg::Configuration::Invalid.new("asset_file should implement the #named method") | ||
method = custom_asset_file.method(:named) | ||
if method.arity == 1 | ||
@asset_file = custom_asset_file | ||
else | ||
raise InlineSvg::Configuration::Invalid.new("asset_file should implement the #named method with arity 1") | ||
end | ||
rescue NameError | ||
raise InlineSvg::Configuration::Invalid.new("asset_file should implement the #named method") | ||
end | ||
|
||
def asset_finder=(finder) | ||
|
@@ -67,7 +65,7 @@ def add_custom_transformation(options) | |
raise InlineSvg::Configuration::Invalid.new("#{options.fetch(:transform)} should implement the .create_with_value and #transform methods") | ||
end | ||
|
||
@custom_transformations.merge!(Hash[*[options.fetch(:attribute, :no_attribute), options]]) | ||
@custom_transformations.merge!(options.fetch(:attribute, :no_attribute) => options) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Manual fix 1: looks safe to me |
||
end | ||
|
||
def raise_on_file_not_found=(value) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ def self.without_empty_values(params) | |
def self.all_default_values | ||
custom_transformations | ||
.values | ||
.select { |opt| opt[:default_value] != nil } | ||
.reject { |opt| opt[:default_value].nil? } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Manual fix 2: looks safe to me |
||
.map { |opt| [opt[:attribute], opt[:default_value]] } | ||
.inject({}) { |options, attrs| options.merge!(attrs[0] => attrs[1]) } | ||
end | ||
|
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.
suggestion: review with "hide whitespaces"