Get current default value

asked 2016-06-01 11:20:54 -0600

Artefacto gravatar image

I managed to get the default value for a resource with this (so that I can add something to the defaults):

define foo::bar($v) {}
Foo::Bar {
    v => { 'foo' => 'bar' }
}
$a = parsejson(inline_template('<%= require "json"; scope.lookupdefaults("Foo::Bar")[:v].value.to_json %>'))
notice($a + { 'a' => 'b' })

It's quite clunky though, so I wonder if there's a better way.

edit retag flag offensive close merge delete