diff --git a/lib/riemann/tools.rb b/lib/riemann/tools.rb index a5549698..c3338ccc 100644 --- a/lib/riemann/tools.rb +++ b/lib/riemann/tools.rb @@ -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) diff --git a/tools/riemann-riak/lib/riemann/tools/riak.rb b/tools/riemann-riak/lib/riemann/tools/riak.rb index 60c06eda..e2638640 100644 --- a/tools/riemann-riak/lib/riemann/tools/riak.rb +++ b/tools/riemann-riak/lib/riemann/tools/riak.rb @@ -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