Class: PuppetX::VMware::Mapper::Leaf
- Inherits:
-
MapComponent
- Object
- MapComponent
- PuppetX::VMware::Mapper::Leaf
- Defined in:
- lib/puppet_x/vmware/mapper.rb
Constant Summary collapse
- Prop_names =
[ :desc, :misc, :munge, :path_is_now, :path_should, :prop_name, :requires, :validate, :valid_enum, ]
Instance Method Summary collapse
-
#initialize(input) ⇒ Leaf
constructor
A new instance of Leaf.
Constructor Details
#initialize(input) ⇒ Leaf
Returns a new instance of Leaf.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/puppet_x/vmware/mapper.rb', line 79 def initialize input # copy input to @props hash super input, Prop_names # check for required values fail "#{self.class} doesn't include 'path_should'" unless @props[:path_should] @props[:misc] ||= [] @props[:requires] ||= [] # set defaults and munge @props[:path_is_now] ||= @props[:path_should] # .dup not necessary because of following map to_sym @props[:path_is_now] = @props[:path_is_now].map{|v| v.to_sym} @props[:path_should] = @props[:path_should].map{|v| v.to_sym} @props[:prop_name] ||= PuppetX::VMware::Util.snakeize(@props[:path_should][-1]).to_sym end |