concat_is_bool.rb 503 B

12345678910111213141516171819202122
  1. #
  2. # concat_is_bool.rb
  3. #
  4. module Puppet::Parser::Functions
  5. newfunction(:concat_is_bool, :type => :rvalue, :doc => <<-EOS
  6. Returns true if the variable passed to this function is a boolean.
  7. EOS
  8. ) do |arguments|
  9. raise(Puppet::ParseError, "concat_is_bool(): Wrong number of arguments " +
  10. "given (#{arguments.size} for 1)") if arguments.size != 1
  11. type = arguments[0]
  12. result = type.is_a?(TrueClass) || type.is_a?(FalseClass)
  13. return result
  14. end
  15. end
  16. # vim: set ts=2 sw=2 et :