source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/types/compat/float.pp@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

File size: 746 bytes
Line 
1# Emulate the is_float function
2# The regex is what's currently used in is_float
3# To keep your development moving forward, you can also add a deprecation warning using the Integer type:
4#
5# ```class example($value) { validate_float($value,) }```
6#
7# would turn into
8#
9# ```
10# class example(Stdlib::Compat::Float $value) {
11# validate_float($value, 10, 0)
12# assert_type(Integer[0, 10], $value) |$expected, $actual| {
13# warning("The 'value' parameter for the 'ntp' class has type ${actual}, but should be ${expected}.")
14# }
15# }
16# ```
17#
18# This allows you to find all places where a consumers of your code call it with unexpected values.
19type Stdlib::Compat::Float = Variant[Float, Pattern[/^-?(?:(?:[1-9]\d*)|0)(?:\.\d+)(?:[eE]-?\d+)?$/]]
Note: See TracBrowser for help on using the repository browser.