Mercurial > repos > other > Puppet
comparison modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children |
comparison
equal
deleted
inserted
replaced
274:b2571c28fc27 | 275:d9352a684e62 |
---|---|
1 # | 1 # |
2 # validate_email_address.rb | 2 # validate_email_address.rb |
3 # | 3 # |
4 module Puppet::Parser::Functions | 4 module Puppet::Parser::Functions |
5 newfunction(:validate_email_address, :doc => <<-DOC | 5 newfunction(:validate_email_address, :doc => <<-DOC |
6 Validate that all values passed are valid email addresses. | 6 @summary |
7 Fail compilation if any value fails this check. | 7 Validate that all values passed are valid email addresses. |
8 The following values will pass: | 8 Fail compilation if any value fails this check. |
9 $my_email = "waldo@gmail.com" | |
10 validate_email_address($my_email) | |
11 validate_email_address("bob@gmail.com", "alice@gmail.com", $my_email) | |
12 | 9 |
13 The following values will fail, causing compilation to abort: | 10 @return |
14 $some_array = [ 'bad_email@/d/efdf.com' ] | 11 Fail compilation if any value fails this check. |
15 validate_email_address($some_array) | 12 |
13 @example **Usage** | |
14 | |
15 The following values will pass: | |
16 | |
17 $my_email = "waldo@gmail.com" | |
18 validate_email_address($my_email) | |
19 validate_email_address("bob@gmail.com", "alice@gmail.com", $my_email) | |
20 | |
21 The following values will fail, causing compilation to abort: | |
22 | |
23 $some_array = [ 'bad_email@/d/efdf.com' ] | |
24 validate_email_address($some_array) | |
16 DOC | 25 DOC |
17 ) do |args| | 26 ) do |args| |
18 rescuable_exceptions = [ArgumentError] | 27 rescuable_exceptions = [ArgumentError] |
19 | 28 |
20 if args.empty? | 29 if args.empty? |