Class: Puppet::ResourceApi::ResourceShim
- Inherits:
-
Object
- Object
- Puppet::ResourceApi::ResourceShim
- Defined in:
- lib/puppet/resource_api/glue.rb
Overview
A trivial class to provide the functionality required to push data through the existing type/provider parts of puppet
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(resource_hash) ⇒ ResourceShim
constructor
A new instance of ResourceShim.
- #prune_parameters(*_args) ⇒ Object
- #title ⇒ Object
- #to_manifest ⇒ Object
Constructor Details
#initialize(resource_hash) ⇒ ResourceShim
Returns a new instance of ResourceShim.
28 29 30 |
# File 'lib/puppet/resource_api/glue.rb', line 28 def initialize(resource_hash) @values = resource_hash.dup.freeze # whatevs end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
26 27 28 |
# File 'lib/puppet/resource_api/glue.rb', line 26 def values @values end |
Instance Method Details
#prune_parameters(*_args) ⇒ Object
36 37 38 39 |
# File 'lib/puppet/resource_api/glue.rb', line 36 def prune_parameters(*_args) # puts "not pruning #{args.inspect}" if args.length > 0 self end |
#title ⇒ Object
32 33 34 |
# File 'lib/puppet/resource_api/glue.rb', line 32 def title values[:name] end |
#to_manifest ⇒ Object
41 42 43 44 |
# File 'lib/puppet/resource_api/glue.rb', line 41 def to_manifest # TODO: get the correct typename here (["SOMETYPE { #{values[:name].inspect}: "] + values.keys.reject { |k| k == :name }.map { |k| " #{k} => #{values[k].inspect}," } + ['}']).join("\n") end |