Skip to content

Commit

Permalink
Autofix save RuboCop performance offenses
Browse files Browse the repository at this point in the history
- Performance/BlockGivenWithExplicitBlock
- Performance/StringReplacement
  • Loading branch information
tagliala committed Oct 24, 2023
1 parent 2b6b10e commit d55a7f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/arbre/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(assigns = {}, helpers = nil, &block)
@_current_arbre_element_buffer = [self]

super(self)
instance_eval(&block) if block_given?
instance_eval(&block) if block
end

def arbre_context
Expand Down
4 changes: 2 additions & 2 deletions lib/arbre/element/builder_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def build_tag(klass, *args, &block)
tag.parent = current_arbre_element

with_current_arbre_element tag do
if block_given? && block.arity > 0
if block && block.arity > 0
tag.build(*args, &block)
else
tag.build(*args)
append_return_block(yield) if block_given?
append_return_block(yield) if block
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/arbre/html/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def dom_class_name_for(record)
if record.class.respond_to?(:model_name)
record.class.model_name.singular
else
record.class.name.underscore.gsub("/", "_")
record.class.name.underscore.tr("/", "_")
end
end

Expand Down

0 comments on commit d55a7f7

Please sign in to comment.