Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / is_bool.rb
1 #
2 # is_bool.rb
3 #
4 module Puppet::Parser::Functions
5   newfunction(:is_bool, :type => :rvalue, :doc => <<-DOC
6     @summary
7       **Deprecated:** Returns true if the variable passed to this function is a boolean.
8
9     @return [Boolean]
10       Returns `true` or `false`
11
12     > **Note:* **Deprecated** Will be removed in a future version of stdlib. See
13     [`validate_legacy`](#validate_legacy).
14     DOC
15              ) do |arguments|
16
17     function_deprecation([:is_bool, 'This method is deprecated, please use the stdlib validate_legacy function,
18                           with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.'])
19
20     raise(Puppet::ParseError, "is_bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
21
22     type = arguments[0]
23
24     result = type.is_a?(TrueClass) || type.is_a?(FalseClass)
25
26     return result
27   end
28 end