Sha256: 20923f4f97e898c7bf7ff4f6af1a7252ddb7880ce187854d96c634f6502bd563

Contents?: true

Size: 798 Bytes

Versions: 48

Compression:

Stored size: 798 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|
  Error.is4x('dig')
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
puppet-5.0.0 lib/puppet/parser/functions/dig.rb
puppet-5.0.0-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-5.0.0-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-5.0.0-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.10.4 lib/puppet/parser/functions/dig.rb
puppet-4.10.4-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.4-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.4-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.10.1 lib/puppet/parser/functions/dig.rb
puppet-4.10.1-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.1-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.1-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.10.0 lib/puppet/parser/functions/dig.rb
puppet-4.10.0-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.0-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.0-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.9.4 lib/puppet/parser/functions/dig.rb
puppet-4.9.4-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.9.4-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.9.4-universal-darwin lib/puppet/parser/functions/dig.rb