Skip to content

Commit fde76f5

Browse files
committed
(GH-cat-9) Rubocop fixes
1 parent 0677bfb commit fde76f5

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

lib/puppet/parser/functions/validate_integer.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,11 @@ module Puppet::Parser::Functions
119119
when Array
120120
# check every element of the array
121121
input.each_with_index do |arg, pos|
122-
begin
123-
raise TypeError if arg.is_a?(Hash)
124-
arg = Integer(arg.to_s)
125-
validator.call(arg)
126-
rescue TypeError, ArgumentError
127-
raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}"
128-
end
122+
raise TypeError if arg.is_a?(Hash)
123+
arg = Integer(arg.to_s)
124+
validator.call(arg)
125+
rescue TypeError, ArgumentError
126+
raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}"
129127
end
130128
# for the sake of compatibility with ruby 1.8, we need extra handling of hashes
131129
when Hash

lib/puppet/parser/functions/validate_numeric.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,11 @@ module Puppet::Parser::Functions
7979
when Array
8080
# check every element of the array
8181
input.each_with_index do |arg, pos|
82-
begin
83-
raise TypeError if arg.is_a?(Hash)
84-
arg = Float(arg.to_s)
85-
validator.call(arg)
86-
rescue TypeError, ArgumentError
87-
raise Puppet::ParseError, "validate_numeric(): Expected element at array position #{pos} to be a Numeric, got #{arg.class}"
88-
end
82+
raise TypeError if arg.is_a?(Hash)
83+
arg = Float(arg.to_s)
84+
validator.call(arg)
85+
rescue TypeError, ArgumentError
86+
raise Puppet::ParseError, "validate_numeric(): Expected element at array position #{pos} to be a Numeric, got #{arg.class}"
8987
end
9088
# for the sake of compatibility with ruby 1.8, we need extra handling of hashes
9189
when Hash

0 commit comments

Comments
 (0)