Sha256: 1b324d8461d3dc3324fb732381e71c7192ea84633d7a9cd0add3c8082050f9bf

Contents?: true

Size: 825 Bytes

Versions: 44

Compression:

Stored size: 825 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|
  Puppet::Parser::Functions::Error.is4x('dig')
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/parser/functions/dig.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/parser/functions/dig.rb
puppet-4.10.12 lib/puppet/parser/functions/dig.rb
puppet-4.10.12-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.12-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.12-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.10.11 lib/puppet/parser/functions/dig.rb
puppet-4.10.11-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.11-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.11-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-4.10.10 lib/puppet/parser/functions/dig.rb
puppet-4.10.10-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.10-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.10-universal-darwin lib/puppet/parser/functions/dig.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/parser/functions/dig.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/parser/functions/dig.rb
puppet-4.10.9 lib/puppet/parser/functions/dig.rb
puppet-4.10.9-x86-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.9-x64-mingw32 lib/puppet/parser/functions/dig.rb
puppet-4.10.9-universal-darwin lib/puppet/parser/functions/dig.rb