# class Chef::Resource::RegistryKey

### Public Class Methods

new(name, run_context=nil) click to toggle source
Calls superclass method Chef::Resource.new

    # File lib/chef/resource/registry_key.rb, line 28
    def initialize(name, run_context=nil)
      super
      @resource_name = :registry_key
      @action = :create
      @architecture = :machine
      @recursive = false
      @key = name
      @values = []
      @allowed_actions.push(:create, :create_if_missing, :delete, :delete_key)
    end

### Public Instance Methods

architecture(arg=nil) click to toggle source

    # File lib/chef/resource/registry_key.rb, line 76
    def architecture(arg=nil)
      set_or_return(
        :architecture,
        arg,
        :kind_of => Symbol
      )
    end

key(arg=nil) click to toggle source

    # File lib/chef/resource/registry_key.rb, line 39
    def key(arg=nil)
      set_or_return(
        :key,
        arg,
        :kind_of => String
      )
    end

recursive(arg=nil) click to toggle source

    # File lib/chef/resource/registry_key.rb, line 69
    def recursive(arg=nil)
      set_or_return(
        :recursive,
        arg,
        :kind_of => [TrueClass, FalseClass]
      )
    end

values(arg=nil) click to toggle source

    # File lib/chef/resource/registry_key.rb, line 46
    def values(arg=nil)
      if not arg.nil?
        if arg.is_a?(Hash)
          @values = [ arg ]
        elsif arg.is_a?(Array)
          @values = arg
        else
          raise ArgumentError, "Bad type for RegistryKey resource, use Hash or Array"
        end
        @values.each do |v|
          raise ArgumentError, "Missing name key in RegistryKey values hash" unless v.has_key?(:name)
          raise ArgumentError, "Missing type key in RegistryKey values hash" unless v.has_key?(:type)
          raise ArgumentError, "Missing data key in RegistryKey values hash" unless v.has_key?(:data)
          v.each_key do |key|
            raise ArgumentError, "Bad key #{key} in RegistryKey values hash" unless [:name,:type,:data].include?(key)
          end
          raise ArgumentError, "Type of name => #{v[:name]} should be string" unless v[:name].is_a?(String)
          raise Argument Error "Type of type => #{v[:name]} should be symbol" unless v[:type].is_a?(Symbol)
        end
      elsif self.instance_variable_defined?(:@values) == true
        @values
      end
    end