Puppet Function: apache::bool2httpd
- Defined in:
- lib/puppet/functions/apache/bool2httpd.rb
- Function type:
- Ruby 4.x API
Overview
Transform a supposed boolean to On or Off. Pass all other values through. Given a nil value (undef), bool2httpd will return ‘Off’
Example:
$trace_enable = false
$server_signature = 'mail'
bool2httpd($trace_enable)
# => 'Off'
bool2httpd($server_signature)
# => 'mail'
bool2httpd(undef)
# => 'Off'
15 16 17 18 19 20 21 |
# File 'lib/puppet/functions/apache/bool2httpd.rb', line 15 Puppet::Functions.create_function(:'apache::bool2httpd') do def bool2httpd(arg) return 'Off' if arg.nil? || arg == false || arg =~ %r{false}i || arg == :undef return 'On' if arg == true || arg =~ %r{true}i arg.to_s end end |