Skip to content

Commit d37c9ab

Browse files
committed
Idiomatic syntax for should_policy and should_vhost
1 parent cf30101 commit d37c9ab

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,11 @@ def policies(name, vhost)
3535
end
3636

3737
def should_policy
38-
if @should_policy
39-
@should_policy
40-
else
41-
@should_policy = resource[:name].rpartition('@').first
42-
end
38+
@should_policy ||= resource[:name].rpartition('@').first
4339
end
4440

4541
def should_vhost
46-
if @should_vhost
47-
@should_vhost
48-
else
49-
@should_vhost = resource[:name].rpartition('@').last
50-
end
42+
@should_vhost ||= resource[:name].rpartition('@').last
5143
end
5244

5345
def create

0 commit comments

Comments
 (0)