Skip to content

Commit

Permalink
Invert conditional
Browse files Browse the repository at this point in the history
This avoid a method call and also is easier to read.
  • Loading branch information
rafaelfranca committed Nov 15, 2021
1 parent 83ce6e3 commit a134eeb
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -92,10 +92,10 @@ class Object
def with_options(options, &block)
option_merger = ActiveSupport::OptionMerger.new(self, options)

if block.nil?
option_merger
else
if block
block.arity.zero? ? option_merger.instance_eval(&block) : block.call(option_merger)
else
option_merger
end
end
end

0 comments on commit a134eeb

Please sign in to comment.