From 3a96cc957dbd97c6ffeaea42f738e7c35b4acbc7 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 9 Mar 2015 13:08:33 +0000 Subject: Avoid "Array.new" and "Hash.new" Instead use {} + (). --- lib/custodian/parser.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/custodian/parser.rb') diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index e73001f..0bafd47 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -53,8 +53,8 @@ module Custodian # Constructor # def initialize - @MACROS = Hash.new() - @jobs = Array.new() + @MACROS = {} + @jobs = [] end @@ -119,7 +119,7 @@ module Custodian # def define_macro( line ) name = nil - val = Array.new + val = [] # # Get the name of the macro. @@ -212,7 +212,7 @@ module Custodian # def expand_macro( input ) - r = Array.new() + r = [] if ( input =~ /^(\S+)\s+(.*)$/ ) macro=$1.dup @@ -320,7 +320,7 @@ module Custodian # # The array of objects we will return to the caller. # - ret = Array.new() + ret = [] # # For each host in our possibly-macro-expanded list: -- cgit v1.2.1