Class: PuppetX::VMware::MapperNsx::Leaf
- Inherits:
-
MapComponent
- Object
- MapComponent
- PuppetX::VMware::MapperNsx::Leaf
- Defined in:
- lib/puppet_x/vmware/mapper_nsx.rb
Constant Summary collapse
- Prop_names =
[ :desc, :misc, :munge, :olio, :path_is_now, :path_should, :prop_name, :requires, :requires_siblings, :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.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/puppet_x/vmware/mapper_nsx.rb', line 91 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[:olio] ||= {} @props[:requires] ||= [] @props[:requires_siblings] ||= [] # 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_s} @props[:path_should] = @props[:path_should].map{|v| v.to_s} @props[:prop_name] = case @props[:prop_name] when nil, PROP_NAME_IS_FULL_PATH # autogenerate using full path x = @props[:path_should]. map{|name| PuppetX::VMware::Util.snakeize name}. join "_" x = x.to_sym else # specified explicitly in map @props[:prop_name] end # gyoku expects '@' prefix on keys to indicate xml attributes # but puppet and ruby don't like '@' signs in method identifiers @props[:prop_name] = @props[:prop_name].to_s.gsub(/@/, '').to_sym end |