Method: Puppet::Pops::Lookup::DataProvider#validate_data_value
- Defined in:
- lib/puppet/pops/lookup/data_provider.rb
#validate_data_value(value, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Asserts that data_value is of valid type. Will yield to obtain origin of value in case an error is produced
84 85 86 87 88 89 90 91 |
# File 'lib/puppet/pops/lookup/data_provider.rb', line 84 def validate_data_value(value, &block) # The DataProvider.value_type is self recursive so further recursive check of collections is needed here unless value_is_validated? || DataProvider.value_type.instance?(value) actual_type = Types::TypeCalculator.singleton.infer(value) raise Types::TypeAssertionError.new("#{yield} has wrong type, expects Puppet::LookupValue, got #{actual_type}", DataProvider.value_type, actual_type) end value end |