summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shuffle.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/shuffle.rb b/shuffle.rb
index 2bba584..73e798c 100644
--- a/shuffle.rb
+++ b/shuffle.rb
@@ -13,20 +13,20 @@ module Puppet::Parser::Functions
value = arguments[0]
klass = value.class
- if not [Array, String].include?(klass)
- raise(Puppet::ParseError, 'shuffle(): Requires either an ' +
+ unless [Array, String].include?(klass)
+ raise(Puppet::ParseError, 'shuffle(): Requires either ' +
'array or string to work with')
end
result = value.clone
- string_type = value.is_a?(String) ? true : false
+ string = value.is_a?(String) ? true : false
# Check whether it makes sense to shuffle ...
return result if result.size <= 1
# We turn any string value into an array to be able to shuffle ...
- result = string_type ? result.split('') : result
+ result = string ? result.split('') : result
elements = result.size
@@ -36,7 +36,7 @@ module Puppet::Parser::Functions
result[j], result[i] = result[i], result[j]
end
- result = string_type ? result.join : result
+ result = string ? result.join : result
return result
end