lib/rubocop/cop/rails/blank.rb in rubocop-rails-2.18.0 vs lib/rubocop/cop/rails/blank.rb in rubocop-rails-2.19.0
- old
+ new
@@ -140,23 +140,23 @@
def autocorrect(corrector, node)
method_call, variable1 = unless_present?(node)
if method_call
corrector.replace(node.loc.keyword, 'if')
- range = method_call.loc.expression
+ range = method_call.source_range
else
variable1, _variable2 = nil_or_empty?(node) || not_present?(node)
- range = node.loc.expression
+ range = node.source_range
end
corrector.replace(range, replacement(variable1))
end
def unless_condition(node, method_call)
if node.modifier_form?
- node.loc.keyword.join(node.loc.expression.end)
+ node.loc.keyword.join(node.source_range.end)
else
- node.loc.expression.begin.join(method_call.loc.expression)
+ node.source_range.begin.join(method_call.source_range)
end
end
def replacement(node)
node.respond_to?(:source) ? "#{node.source}.blank?" : 'blank?'