Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/puppet/resource_api/glue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def to_hierayaml
YAML.dump('type' => { title => attributes }).split("\n").drop(2).join("\n") + "\n"
end

def to_hash
values
end

# attribute names that are not title or namevars
def filtered_keys
values.keys.reject { |k| k == :title || !attr_def[k] || (attr_def[k][:behaviour] == :namevar && @namevars.size == 1) }
Expand Down
4 changes: 4 additions & 0 deletions spec/puppet/resource_api/glue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@
it { expect(instance.to_hierayaml).to eq " ? |-\n foo:\n bar\n : attr: value\n attr_ro: fixed\n" }
end
end

describe '.to_hash' do
it { expect(instance.to_hash).to eq(namevarname: 'title', attr: 'value', attr_ro: 'fixed') }
end
end
end