Skip to content

Commit

Permalink
style: Suppress Performance/StringIdentifierArgument cop
Browse files Browse the repository at this point in the history
```
Performance/StringIdentifierArgument: Use :"after_#{action}" instead of "after_#{action}".
```
  • Loading branch information
mishina2228 committed Dec 29, 2023
1 parent 7504d54 commit c4910d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/god/cli/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setup
def dispatch
if %w[load status signal log quit terminate].include?(@command)
setup
send("#{@command}_command")
send(:"#{@command}_command")
elsif %w[start stop restart monitor unmonitor remove].include?(@command)
setup
lifecycle_command
Expand Down
2 changes: 1 addition & 1 deletion lib/god/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def self.defaults
end

def arg(name)
instance_variable_get("@#{name}") || self.class.instance_variable_get("@#{name}")
instance_variable_get(:"@#{name}") || self.class.instance_variable_get(:"@#{name}")
end

# Normalize the given notify specification into canonical form.
Expand Down
4 changes: 2 additions & 2 deletions lib/god/watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def call_action(condition, action)
before_items = behaviors
before_items += [condition] if condition
before_items.each do |b|
info = b.send("before_#{action}")
info = b.send(:"before_#{action}")
if info
msg = "#{name} before_#{action}: #{info} (#{b.base_name})"
applog(self, :info, msg)
Expand All @@ -304,7 +304,7 @@ def call_action(condition, action)
after_items = behaviors
after_items += [condition] if condition
after_items.each do |b|
info = b.send("after_#{action}")
info = b.send(:"after_#{action}")
if info
msg = "#{name} after_#{action}: #{info} (#{b.base_name})"
applog(self, :info, msg)
Expand Down
4 changes: 2 additions & 2 deletions test/test_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_call_action_should_write_pid
@p.expects(:fork)
Process.expects(:waitpid)
File.expects(:write).with(@p.default_pid_file, pid)
@p.send("#{action}=", 'run')
@p.send(:"#{action}=", 'run')
@p.call_action(action)
end
end
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_call_action_with_invalid_command_class_should_raise
def test_start_stop_restart_bang
[:start, :stop, :restart].each do |x|
@p.expects(:call_action).with(x)
@p.send("#{x}!")
@p.send(:"#{x}!")
end
end
end

0 comments on commit c4910d4

Please sign in to comment.