Sha256: 424d17fecefa71c593a0fb69a3c5796c3694f2f2efc80e3daa79b901adc32adc

Contents?: true

Size: 865 Bytes

Versions: 16

Compression:

Stored size: 865 Bytes

Contents

Puppet::Parser::Functions::newfunction(
  :dig,
  :type => :rvalue,
  :arity => -1,
  :doc => <<-DOC
Returns a value for a sequence of given keys/indexes into a structure.
This function is used to "dig into" a complex data structure by
using a sequence of keys / indexes to access a value from which
the next key/index is accessed recursively.

The first encountered `undef` value or key stops the "dig" and `undef` is returned.

An error is raised if an attempt is made to "dig" into
something other than an `undef` (which immediately returns `undef`), an `Array` or a `Hash`.

**Example:** Using `dig`

```puppet
$data = {a => { b => [{x => 10, y => 20}, {x => 100, y => 200}]}}
notice $data.dig(a, b, 1, x)
```

Would notice the value 100.

* Since 4.5.0
DOC
) do |args|
  function_fail(["dig() is only available when parser/evaluator future is in effect"])
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-4.7.1 lib/puppet/parser/functions/dig.rb
puppet-4.7.1-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.7.1-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.7.1-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.7.0 lib/puppet/parser/functions/dig.rb
puppet-4.7.0-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.7.0-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.7.0-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.6.2 lib/puppet/parser/functions/dig.rb
puppet-4.6.2-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.6.2-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.6.2-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.6.1-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.6.1 lib/puppet/parser/functions/dig.rb
puppet-4.6.1-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.6.1-universal-darwin lib/puppet/parser/functions/dig.rb