Skip to content

Commit

Permalink
Autocorrect Style/HashConversion: Prefer ary.to_h to Hash[ary]
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jan 21, 2024
1 parent 8d65831 commit d098f9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/riemann/tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def options
alias opts options

def attributes
@attributes ||= Hash[options[:attribute].map do |attr|
@attributes ||= options[:attribute].map do |attr|
k, v = attr.split('=')
[k, v] if k && v
end]
end.to_h
end

def report(event)
Expand Down
2 changes: 1 addition & 1 deletion tools/riemann-riak/lib/riemann/tools/riak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def stats_riak_admin
str = `riak-admin status`
raise 'riak-admin failed' unless $CHILD_STATUS == 0

Hash[str.split("\n").map { |i| i.split(' : ') }]
str.split("\n").map { |i| i.split(' : ') }.to_h
end

# Get current stats as a hash
Expand Down

0 comments on commit d098f9e

Please sign in to comment.