### Home Classes Methods

### In Files

- lib/chef/node/attribute.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #attribute
- #attribute=
- #attribute?
- #auto_vivifiy
- #auto_vivifiy_on_read?
- #component_has_key?
- #delete
- #delete_from_component
- #determine_value
- #each
- #each_attribute
- #each_key
- #each_pair
- #each_value
- #empty?
- #fetch
- #get_keys
- #get_value
- #has_key?
- #has_value?
- #hash_and_not_cna?
- #include?
- #index
- #inspect
- #key?
- #keys
- #kind_of?
- #length
- #member?
- #method_missing
- #reset
- #set_type_hash
- #set_value
- #size
- #to_hash
- #value?
- #value_at_current_nesting
- #value_or_descend
- #values

### Included Modules

- Enumerable

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Chef
- Chef::ApiClient
- Chef::Application
- Chef::Application::Client
- Chef::Application::Knife
- Chef::Application::Solo
- Chef::Application::Wakeup
- Chef::Application::WindowsService
- Chef::Certificate
- Chef::Checksum
- Chef::Checksum::Storage
- Chef::Checksum::Storage::Filesystem
- Chef::ChecksumCache
- Chef::Client
- Chef::Config
- Chef::Cookbook
- Chef::Cookbook::Chefignore
- Chef::Cookbook::CookbookVersionLoader
- Chef::Cookbook::FileSystemFileVendor
- Chef::Cookbook::FileVendor
- Chef::Cookbook::Metadata
- Chef::Cookbook::MinimalMetadata
- Chef::Cookbook::RemoteFileVendor
- Chef::Cookbook::SyntaxCheck
- Chef::CookbookCacheCleaner
- Chef::CookbookCollection
- Chef::CookbookLoader
- Chef::CookbookSiteStreamingUploader
- Chef::CookbookSiteStreamingUploader::MultipartStream
- Chef::CookbookSiteStreamingUploader::StreamPart
- Chef::CookbookSiteStreamingUploader::StringPart
- Chef::CookbookSynchronizer
- Chef::CookbookUploader
- Chef::CookbookVersion
- Chef::CookbookVersionSelector
- Chef::CouchDB
- Chef::Daemon
- Chef::DataBag
- Chef::DataBagItem
- Chef::EncryptedDataBagItem
- Chef::EncryptedDataBagItem::DecryptionFailure
- Chef::EncryptedDataBagItem::Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version0Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version1Decryptor
- Chef::EncryptedDataBagItem::UnsupportedCipher
- Chef::EncryptedDataBagItem::UnsupportedEncryptedDataBagItemFormat
- Chef::Environment
- Chef::EventDispatch
- Chef::EventDispatch::Base
- Chef::EventDispatch::Dispatcher
- Chef::Exceptions
- Chef::Exceptions::AmbiguousRunlistSpecification
- Chef::Exceptions::Application
- Chef::Exceptions::AttributeNotFound
- Chef::Exceptions::CannotDetermineNodeName
- Chef::Exceptions::CannotWritePrivateKey
- Chef::Exceptions::CommandTimeout
- Chef::Exceptions::ConfigurationError
- Chef::Exceptions::CookbookFrozen
- Chef::Exceptions::CookbookNotFound
- Chef::Exceptions::CookbookNotFoundInRepo
- Chef::Exceptions::CookbookVersionConflict
- Chef::Exceptions::CookbookVersionNameMismatch
- Chef::Exceptions::CookbookVersionSelection
- Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems
- Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem
- Chef::Exceptions::CouchDBNotFound
- Chef::Exceptions::Cron
- Chef::Exceptions::DsclCommandFailed
- Chef::Exceptions::EnclosingDirectoryDoesNotExist
- Chef::Exceptions::Env
- Chef::Exceptions::ErlCall
- Chef::Exceptions::Exec
- Chef::Exceptions::FileNotFound
- Chef::Exceptions::Group
- Chef::Exceptions::GroupIDNotFound
- Chef::Exceptions::Ifconfig
- Chef::Exceptions::IllegalChecksumRevert
- Chef::Exceptions::InsufficientPermissions
- Chef::Exceptions::InvalidCommandOption
- Chef::Exceptions::InvalidCookbookVersion
- Chef::Exceptions::InvalidDataBagItemID
- Chef::Exceptions::InvalidDataBagName
- Chef::Exceptions::InvalidDataBagPath
- Chef::Exceptions::InvalidEnvironmentRunListSpecification
- Chef::Exceptions::InvalidHomeDirectory
- Chef::Exceptions::InvalidPrivateKey
- Chef::Exceptions::InvalidRemoteGitReference
- Chef::Exceptions::InvalidResourceReference
- Chef::Exceptions::InvalidResourceSpecification
- Chef::Exceptions::InvalidVersionConstraint
- Chef::Exceptions::Link
- Chef::Exceptions::MissingLibrary
- Chef::Exceptions::MissingParentDirectory
- Chef::Exceptions::MissingRole
- Chef::Exceptions::Mount
- Chef::Exceptions::ObsoleteDependencySyntax
- Chef::Exceptions::Override
- Chef::Exceptions::Package
- Chef::Exceptions::PrivateKeyMissing
- Chef::Exceptions::QueryParseError
- Chef::Exceptions::RecipeNotFound
- Chef::Exceptions::RedirectLimitExceeded
- Chef::Exceptions::RequestedUIDUnavailable
- Chef::Exceptions::ResourceNotFound
- Chef::Exceptions::RoleNotFound
- Chef::Exceptions::Route
- Chef::Exceptions::SearchIndex
- Chef::Exceptions::Service
- Chef::Exceptions::ShellCommandFailed
- Chef::Exceptions::SolrConnectionError
- Chef::Exceptions::UnresolvableGitReference
- Chef::Exceptions::UnsupportedAction
- Chef::Exceptions::User
- Chef::Exceptions::UserIDNotFound
- Chef::Exceptions::ValidationFailed
- Chef::Exceptions::Win32APIError
- Chef::Exceptions::Win32APIFunctionNotImplemented
- Chef::FileAccessControl
- Chef::FileAccessControl::Unix
- Chef::FileAccessControl::Windows
- Chef::FileCache
- Chef::Formatters
- Chef::Formatters::APIErrorFormatting
- Chef::Formatters::Base
- Chef::Formatters::Doc
- Chef::Formatters::ErrorDescription
- Chef::Formatters::ErrorInspectors
- Chef::Formatters::ErrorInspectors::CompileErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookSyncErrorInspector
- Chef::Formatters::ErrorInspectors::NodeLoadErrorInspector
- Chef::Formatters::ErrorInspectors::RegistrationErrorInspector
- Chef::Formatters::ErrorInspectors::ResourceFailureInspector
- Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector
- Chef::Formatters::ErrorMapper
- Chef::Formatters::Minimal
- Chef::Formatters::NullFormatter
- Chef::Formatters::Outputter
- Chef::Formatters::UnknownFormatter
- Chef::Handler
- Chef::Handler::ErrorReport
- Chef::Handler::JsonFile
- Chef::IndexQueue
- Chef::IndexQueue::AmqpClient
- Chef::IndexQueue::Consumer
- Chef::IndexQueue::Consumer::ClassMethods
- Chef::IndexQueue::Indexable
- Chef::IndexQueue::Indexable::ClassMethods
- Chef::JSONCompat
- Chef::Knife
- Chef::Knife::Bootstrap
- Chef::Knife::ClientBulkDelete
- Chef::Knife::ClientCreate
- Chef::Knife::ClientDelete
- Chef::Knife::ClientEdit
- Chef::Knife::ClientList
- Chef::Knife::ClientReregister
- Chef::Knife::ClientShow
- Chef::Knife::Configure
- Chef::Knife::ConfigureClient
- Chef::Knife::CookbookBulkDelete
- Chef::Knife::CookbookCreate
- Chef::Knife::CookbookDelete
- Chef::Knife::CookbookDownload
- Chef::Knife::CookbookList
- Chef::Knife::CookbookMetadata
- Chef::Knife::CookbookMetadataFromFile
- Chef::Knife::CookbookSCMRepo
- Chef::Knife::CookbookShow
- Chef::Knife::CookbookSiteDownload
- Chef::Knife::CookbookSiteInstall
- Chef::Knife::CookbookSiteList
- Chef::Knife::CookbookSiteSearch
- Chef::Knife::CookbookSiteShare
- Chef::Knife::CookbookSiteShow
- Chef::Knife::CookbookSiteUnshare
- Chef::Knife::CookbookSiteVendor
- Chef::Knife::CookbookTest
- Chef::Knife::CookbookUpload
- Chef::Knife::Core
- Chef::Knife::Core::BootstrapContext
- Chef::Knife::Core::GenericPresenter
- Chef::Knife::Core::NodeFormattingOptions
- Chef::Knife::Core::NodePresenter
- Chef::Knife::Core::ObjectLoader
- Chef::Knife::Core::ObjectLoader::ObjectType
- Chef::Knife::Core::TextFormatter
- Chef::Knife::DataBagCreate
- Chef::Knife::DataBagDelete
- Chef::Knife::DataBagEdit
- Chef::Knife::DataBagFromFile
- Chef::Knife::DataBagList
- Chef::Knife::DataBagShow
- Chef::Knife::EnvironmentCreate
- Chef::Knife::EnvironmentDelete
- Chef::Knife::EnvironmentEdit
- Chef::Knife::EnvironmentFromFile
- Chef::Knife::EnvironmentList
- Chef::Knife::EnvironmentShow
- Chef::Knife::Exec
- Chef::Knife::Help
- Chef::Knife::IndexRebuild
- Chef::Knife::NodeBulkDelete
- Chef::Knife::NodeCreate
- Chef::Knife::NodeDelete
- Chef::Knife::NodeEdit
- Chef::Knife::NodeEditor
- Chef::Knife::NodeFromFile
- Chef::Knife::NodeList
- Chef::Knife::NodeRunListAdd
- Chef::Knife::NodeRunListRemove
- Chef::Knife::NodeShow
- Chef::Knife::RecipeList
- Chef::Knife::RoleBulkDelete
- Chef::Knife::RoleCreate
- Chef::Knife::RoleDelete
- Chef::Knife::RoleEdit
- Chef::Knife::RoleFromFile
- Chef::Knife::RoleList
- Chef::Knife::RoleShow
- Chef::Knife::Search
- Chef::Knife::Ssh
- Chef::Knife::Status
- Chef::Knife::SubcommandLoader
- Chef::Knife::TagCreate
- Chef::Knife::TagDelete
- Chef::Knife::TagList
- Chef::Knife::UI
- Chef::Log
- Chef::Log::Formatter
- Chef::MinimalCookbookVersion
- Chef::Mixin
- Chef::Mixin::CheckHelper
- Chef::Mixin::Checksum
- Chef::Mixin::Command
- Chef::Mixin::Command::Unix
- Chef::Mixin::Command::Windows
- Chef::Mixin::ConvertToClassName
- Chef::Mixin::CreatePath
- Chef::Mixin::DeepMerge
- Chef::Mixin::DeepMerge::InvalidParameter
- Chef::Mixin::Deprecation
- Chef::Mixin::Deprecation::DeprecatedInstanceVariable
- Chef::Mixin::Deprecation::DeprecatedObjectProxyBase
- Chef::Mixin::EnforceOwnershipAndPermissions
- Chef::Mixin::FileClass
- Chef::Mixin::FromFile
- Chef::Mixin::GetSourceFromPackage
- Chef::Mixin::Language
- Chef::Mixin::Language::PlatformDependentValue
- Chef::Mixin::Language::PlatformFamilyDependentValue
- Chef::Mixin::LanguageIncludeAttribute
- Chef::Mixin::LanguageIncludeRecipe
- Chef::Mixin::ParamsValidate
- Chef::Mixin::PathSanity
- Chef::Mixin::RecipeDefinitionDSLCore
- Chef::Mixin::Securable
- Chef::Mixin::ShellOut
- Chef::Mixin::Template
- Chef::Mixin::Template::ChefContext
- Chef::Mixin::Template::TemplateError
- Chef::Mixin::WhyRun
- Chef::Mixin::WhyRun::ConvergeActions
- Chef::Mixin::WhyRun::ResourceRequirements
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion::AssertionFailure
- Chef::Mixin::XMLEscape
- Chef::Mixin::XMLEscape::FastXS
- Chef::Mixin::XMLEscape::PureRuby
- Chef::Node
- Chef::Node::Attribute
- Chef::OpenIDRegistration
- Chef::Platform
- Chef::Provider
- Chef::Provider::Breakpoint
- Chef::Provider::CookbookFile
- Chef::Provider::Cron
- Chef::Provider::Cron::Solaris
- Chef::Provider::Deploy
- Chef::Provider::Deploy::Revision
- Chef::Provider::Deploy::Timestamped
- Chef::Provider::Directory
- Chef::Provider::Env
- Chef::Provider::Env::Windows
- Chef::Provider::ErlCall
- Chef::Provider::Execute
- Chef::Provider::File
- Chef::Provider::Git
- Chef::Provider::Group
- Chef::Provider::Group::Aix
- Chef::Provider::Group::Dscl
- Chef::Provider::Group::Gpasswd
- Chef::Provider::Group::Groupadd
- Chef::Provider::Group::Groupmod
- Chef::Provider::Group::Pw
- Chef::Provider::Group::Suse
- Chef::Provider::Group::Usermod
- Chef::Provider::Group::Windows
- Chef::Provider::HttpRequest
- Chef::Provider::Ifconfig
- Chef::Provider::Link
- Chef::Provider::Log
- Chef::Provider::Log::ChefLog
- Chef::Provider::Mdadm
- Chef::Provider::Mount
- Chef::Provider::Mount::Mount
- Chef::Provider::Mount::Windows
- Chef::Provider::Ohai
- Chef::Provider::Package
- Chef::Provider::Package::Apt
- Chef::Provider::Package::Dpkg
- Chef::Provider::Package::EasyInstall
- Chef::Provider::Package::Freebsd
- Chef::Provider::Package::Ips
- Chef::Provider::Package::Macports
- Chef::Provider::Package::Pacman
- Chef::Provider::Package::Portage
- Chef::Provider::Package::Rpm
- Chef::Provider::Package::Rubygems
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment
- Chef::Provider::Package::Rubygems::CurrentGemEnvironment
- Chef::Provider::Package::Rubygems::GemEnvironment
- Chef::Provider::Package::SmartOS
- Chef::Provider::Package::Solaris
- Chef::Provider::Package::Yum
- Chef::Provider::Package::Yum::RPMDb
- Chef::Provider::Package::Yum::RPMDbPackage
- Chef::Provider::Package::Yum::RPMDependency
- Chef::Provider::Package::Yum::RPMPackage
- Chef::Provider::Package::Yum::RPMProvide
- Chef::Provider::Package::Yum::RPMRequire
- Chef::Provider::Package::Yum::RPMUtils
- Chef::Provider::Package::Yum::RPMVersion
- Chef::Provider::Package::Yum::YumCache
- Chef::Provider::Package::Zypper
- Chef::Provider::RemoteDirectory
- Chef::Provider::RemoteFile
- Chef::Provider::ResourceUpdate
- Chef::Provider::Route
- Chef::Provider::RubyBlock
- Chef::Provider::Script
- Chef::Provider::Service
- Chef::Provider::Service::Arch
- Chef::Provider::Service::Debian
- Chef::Provider::Service::Freebsd
- Chef::Provider::Service::Gentoo
- Chef::Provider::Service::Init
- Chef::Provider::Service::Insserv
- Chef::Provider::Service::Invokercd
- Chef::Provider::Service::Macosx
- Chef::Provider::Service::Redhat
- Chef::Provider::Service::Simple
- Chef::Provider::Service::Solaris
- Chef::Provider::Service::Systemd
- Chef::Provider::Service::Upstart
- Chef::Provider::Service::Windows
- Chef::Provider::Subversion
- Chef::Provider::Template
- Chef::Provider::User
- Chef::Provider::User::Dscl
- Chef::Provider::User::Pw
- Chef::Provider::User::Useradd
- Chef::Provider::User::Windows
- Chef::REST
- Chef::REST::AuthCredentials
- Chef::REST::CookieJar
- Chef::REST::NoopInflater
- Chef::REST::RESTRequest
- Chef::Recipe
- Chef::ReservedNames
- Chef::ReservedNames::Win32
- Chef::ReservedNames::Win32::API
- Chef::ReservedNames::Win32::API::Error
- Chef::ReservedNames::Win32::API::File
- Chef::ReservedNames::Win32::API::File::BY_HANDLE_FILE_INFORMATION
- Chef::ReservedNames::Win32::API::File::FILETIME
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_GENERIC
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_MOUNT_POINT
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_SYMBOLIC_LINK
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_UNION
- Chef::ReservedNames::Win32::API::File::SECURITY_ATTRIBUTES
- Chef::ReservedNames::Win32::API::File::WIN32_FIND_DATA
- Chef::ReservedNames::Win32::API::Macros
- Chef::ReservedNames::Win32::API::Memory
- Chef::ReservedNames::Win32::API::PSAPI
- Chef::ReservedNames::Win32::API::PSAPI::PROCESS_MEMORY_COUNTERS
- Chef::ReservedNames::Win32::API::Process
- Chef::ReservedNames::Win32::API::Security
- Chef::ReservedNames::Win32::API::Security::ACE_HEADER
- Chef::ReservedNames::Win32::API::Security::ACE_WITH_MASK_AND_SID
- Chef::ReservedNames::Win32::API::Security::ACLStruct
- Chef::ReservedNames::Win32::API::Security::LUID
- Chef::ReservedNames::Win32::API::Security::LUID_AND_ATTRIBUTES
- Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES
- Chef::ReservedNames::Win32::API::System
- Chef::ReservedNames::Win32::API::System::OSVERSIONINFOEX
- Chef::ReservedNames::Win32::API::Unicode
- Chef::ReservedNames::Win32::Error
- Chef::ReservedNames::Win32::File
- Chef::ReservedNames::Win32::File::Info
- Chef::ReservedNames::Win32::Handle
- Chef::ReservedNames::Win32::Memory
- Chef::ReservedNames::Win32::Process
- Chef::ReservedNames::Win32::Security
- Chef::ReservedNames::Win32::Security::ACE
- Chef::ReservedNames::Win32::Security::ACL
- Chef::ReservedNames::Win32::Security::SID
- Chef::ReservedNames::Win32::Security::SecurableObject
- Chef::ReservedNames::Win32::Security::SecurableObject::SecurityConst
- Chef::ReservedNames::Win32::Security::SecurityDescriptor
- Chef::ReservedNames::Win32::Security::Token
- Chef::ReservedNames::Win32::Unicode
- Chef::ReservedNames::Win32::Version
- Chef::Resource
- Chef::Resource::AptPackage
- Chef::Resource::Bash
- Chef::Resource::Breakpoint
- Chef::Resource::ChefGem
- Chef::Resource::Conditional
- Chef::Resource::CookbookFile
- Chef::Resource::Cron
- Chef::Resource::Csh
- Chef::Resource::Deploy
- Chef::Resource::DeployBranch
- Chef::Resource::DeployRevision
- Chef::Resource::Directory
- Chef::Resource::DpkgPackage
- Chef::Resource::EasyInstallPackage
- Chef::Resource::Env
- Chef::Resource::ErlCall
- Chef::Resource::Execute
- Chef::Resource::File
- Chef::Resource::FreebsdPackage
- Chef::Resource::GemPackage
- Chef::Resource::Git
- Chef::Resource::Group
- Chef::Resource::HttpRequest
- Chef::Resource::Ifconfig
- Chef::Resource::IpsPackage
- Chef::Resource::Link
- Chef::Resource::Log
- Chef::Resource::MacportsPackage
- Chef::Resource::Mdadm
- Chef::Resource::Mount
- Chef::Resource::Notification
- Chef::Resource::Ohai
- Chef::Resource::Package
- Chef::Resource::PacmanPackage
- Chef::Resource::Perl
- Chef::Resource::PlatformMap
- Chef::Resource::PortagePackage
- Chef::Resource::Python
- Chef::Resource::RemoteDirectory
- Chef::Resource::RemoteFile
- Chef::Resource::Route
- Chef::Resource::RpmPackage
- Chef::Resource::Ruby
- Chef::Resource::RubyBlock
- Chef::Resource::Scm
- Chef::Resource::Script
- Chef::Resource::Service
- Chef::Resource::SmartOSPackage
- Chef::Resource::SolarisPackage
- Chef::Resource::Subversion
- Chef::Resource::Template
- Chef::Resource::TimestampedDeploy
- Chef::Resource::User
- Chef::Resource::YumPackage
- Chef::ResourceCollection
- Chef::ResourceCollection::StepableIterator
- Chef::ResourceDefinition
- Chef::ResourceDefinitionList
- Chef::ResourceReporter
- Chef::ResourceReporter::ResourceReport
- Chef::Role
- Chef::RunContext
- Chef::RunList
- Chef::RunList::RunListExpansion
- Chef::RunList::RunListExpansionFromAPI
- Chef::RunList::RunListExpansionFromCouchDB
- Chef::RunList::RunListExpansionFromDisk
- Chef::RunList::RunListItem
- Chef::RunList::VersionedRecipeList
- Chef::RunStatus
- Chef::Runner
- Chef::Sandbox
- Chef::ScanAccessControl
- Chef::Search
- Chef::Search::Query
- Chef::ShellOut
- Chef::SolrQuery
- Chef::SolrQuery::QueryTransform
- Chef::SolrQuery::SolrHTTPRequest
- Chef::StreamingCookbookUploader
- Chef::StreamingCookbookUploader::MultipartStream
- Chef::StreamingCookbookUploader::StreamPart
- Chef::StreamingCookbookUploader::StringPart
- Chef::Util
- Chef::Util::FileEdit
- Chef::Util::Windows
- Chef::Util::Windows::NetGroup
- Chef::Util::Windows::NetUse
- Chef::Util::Windows::NetUser
- Chef::Util::Windows::Volume
- Chef::Version
- Chef::VersionConstraint
- Chef::WebUIUser
- Lucene
- Lucene::AndOperator
- Lucene::BinaryOp
- Lucene::Body
- Lucene::BoostOp
- Lucene::ExclFieldRange
- Lucene::Field
- Lucene::FieldName
- Lucene::FieldRange
- Lucene::FuzzyOp
- Lucene::FuzzyParam
- Lucene::Group
- Lucene::InclFieldRange
- Lucene::NotOperator
- Lucene::OrOperator
- Lucene::Phrase
- Lucene::ProhibitedOperator
- Lucene::RangeValue
- Lucene::RequiredOperator
- Lucene::Term
- Lucene::UnaryOp
- Shef
- Shef::ClientSession
- Shef::DoppelGangerClient
- Shef::DoppelGangerSession
- Shef::Extensions
- Shef::Extensions::FalseClass
- Shef::Extensions::ObjectCoreExtensions
- Shef::Extensions::String
- Shef::Extensions::Symbol
- Shef::Extensions::TrueClass
- Shef::ModelWrapper
- Shef::NamedDataBagWrapper
- Shef::Options
- Shef::ShefREST
- Shef::ShefSession
- Shef::SoloSession
- Shef::StandAloneSession
- Net
- Net::HTTPError
- Net::HTTPFatalError
- Net::HTTPRetriableError
- Net::HTTPServerException
- Moneta
- Moneta::BasicFile
- Moneta::Defaults
- FFI
- FFI::Pointer
- FileUtils
- FileUtils::Entry_
- ChefNetHTTPExceptionExtensions
- Dir
- FalseClass
- Mash
- Numeric
- Object
- Regexp
- String
- Symbol
- TrueClass

No matching classes.

# Chef::Node::Attribute

### Constants

HIDDEN_ATTRIBUES

### Attributes

auto_vivifiy_on_read[RW]
automatic[RW]
current_automatic[RW]
current_default[RW]
current_normal[RW]
current_override[RW]
default[RW]
normal[RW]
override[RW]
set_type[RW]
set_unless_value_present[RW]

### Public Class Methods

new(normal, default, override, automatic, state=[]) click to toggle source

    # File lib/chef/node/attribute.rb, line 42
    def initialize(normal, default, override, automatic, state=[])
      @normal = normal
      @current_normal = normal
      @default = default
      @current_default = default
      @override = override
      @current_override = override
      @automatic = automatic
      @current_automatic = automatic
      @current_nesting_level = state
      @auto_vivifiy_on_read = false
      @set_unless_value_present = false
      @set_type = nil
      @has_been_read = false
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/chef/node/attribute.rb, line 89
    def [](key)
      @current_nesting_level << key

      # We set this to so that we can cope with ||= as a setting.
      # See the comments in []= for more details.
      @has_been_read = true

      # If we have a set type, our destiny is to write
      if @set_type
        a_value = @set_type == :automatic ? value_or_descend(current_automatic, key, auto_vivifiy_on_read) : nil
        o_value = @set_type == :override ? value_or_descend(current_override, key, auto_vivifiy_on_read) : nil
        n_value = @set_type == :normal ? value_or_descend(current_normal, key, auto_vivifiy_on_read) : nil
        d_value = @set_type == :default ? value_or_descend(current_default, key, auto_vivifiy_on_read) : nil

        determine_value(a_value, o_value, n_value, d_value)
      # Our destiny is only to read, so we get the full list.
      else
        a_value = value_or_descend(current_automatic, key)
        o_value = value_or_descend(current_override, key)
        n_value = value_or_descend(current_normal, key)
        d_value = value_or_descend(current_default, key)

        determine_value(a_value, o_value, n_value, d_value)
      end
    end

[]=(key, value) click to toggle source

    # File lib/chef/node/attribute.rb, line 319
    def []=(key, value)
      # If we don't have one, then we'll pretend we're normal
      if @set_type.nil?
        @set_type = :normal
        warning=Setting attributes without specifying a precedence is deprecated and will beremoved in Chef 11.0. To set attributes at normal precedence, change code like:`node["key"] = "value"` # Not thisto:`node.set["key"] = "value"` # ThisCalled from:

        warning_with_line_nrs = caller[0...3].inject(warning) do |msg, source_line|
          msg << "  #{source_line}\n"
        end

        Chef::Log.warn(warning_with_line_nrs) if Chef::Config[:chef11_deprecation_warnings]
      end

      if set_unless_value_present
        if get_value(set_type_hash, key) != nil
          Chef::Log.debug("Not setting #{@current_nesting_level.join("/")}/#{key} to #{value.inspect} because it has a #{@set_type} value already")
          return false
        end
      end

      # If we have been read, and the key we are writing is the same
      # as our parent, we have most like been ||='ed.  So we need to
      # just rewind a bit.
      #
      # In practice, these objects are single use - this is just
      # supporting one more single-use style.
      @current_nesting_level.pop if @has_been_read && @current_nesting_level.last == key

      set_value(set_type_hash, key, value)
      value
    end

attribute() click to toggle source

    # File lib/chef/node/attribute.rb, line 58
    def attribute
      normal
    end

attribute=(value) click to toggle source

    # File lib/chef/node/attribute.rb, line 62
    def attribute=(value)
      normal = value
    end

attribute?(key) click to toggle source
Alias for: has_key?
auto_vivifiy(data_hash, key) click to toggle source

    # File lib/chef/node/attribute.rb, line 388
    def auto_vivifiy(data_hash, key)
      if data_hash.has_key?(key)
        unless data_hash[key].respond_to?(:has_key?)
          raise ArgumentError, "You tried to set a nested key, where the parent is not a hash-like object: #{@current_nesting_level.join("/")}/#{key} " unless auto_vivifiy_on_read
        end
      else
        data_hash[key] = Mash.new
      end
      data_hash
    end

auto_vivifiy_on_read?() click to toggle source

    # File lib/chef/node/attribute.rb, line 384
    def auto_vivifiy_on_read?
      auto_vivifiy_on_read
    end

component_has_key?(component_attrs,key) click to toggle source

    # File lib/chef/node/attribute.rb, line 488
    def component_has_key?(component_attrs,key)
      # get the Hash-like object at the current nesting level:
      nested_attrs = value_at_current_nesting(component_attrs, key)
      nested_attrs.respond_to?(:key?) && nested_attrs.key?(key)
    end

delete(key) click to toggle source

    # File lib/chef/node/attribute.rb, line 470
    def delete(key)
      [@automatic, @override, @normal, @default].inject(nil) do |return_value, attrs|
        deleted_value = delete_from_component(attrs, key)
        return_value || deleted_value
      end
    end

delete_from_component(component_attrs, key) click to toggle source

    # File lib/chef/node/attribute.rb, line 477
    def delete_from_component(component_attrs, key)
      # get the Hash-like object at the current nesting level:
      nested_attrs = value_at_current_nesting(component_attrs, key)

      if nested_attrs.respond_to?(:delete)
        nested_attrs.delete(key)
      else
        nil
      end
    end

determine_value(a_value, o_value, n_value, d_value) click to toggle source

    # File lib/chef/node/attribute.rb, line 289
    def determine_value(a_value, o_value, n_value, d_value)
      if hash_and_not_cna?(a_value)
        value = {}
        value = Chef::Mixin::DeepMerge.merge(value, d_value) if hash_and_not_cna?(d_value)
        value = Chef::Mixin::DeepMerge.merge(value, n_value) if hash_and_not_cna?(n_value)
        value = Chef::Mixin::DeepMerge.merge(value, o_value) if hash_and_not_cna?(o_value)
        value = Chef::Mixin::DeepMerge.merge(value, a_value)
        value
      elsif hash_and_not_cna?(o_value)
        value = {}
        value = Chef::Mixin::DeepMerge.merge(value, d_value) if hash_and_not_cna?(d_value)
        value = Chef::Mixin::DeepMerge.merge(value, n_value) if hash_and_not_cna?(n_value)
        value = Chef::Mixin::DeepMerge.merge(value, o_value)
        value
      elsif hash_and_not_cna?(n_value)
        value = {}
        value = Chef::Mixin::DeepMerge.merge(value, d_value) if hash_and_not_cna?(d_value)
        value = Chef::Mixin::DeepMerge.merge(value, n_value)
        value
      elsif hash_and_not_cna?(d_value)
        d_value
      else
        return a_value if ! a_value.nil?
        return o_value if ! o_value.nil?
        return n_value if ! n_value.nil?
        return d_value if ! d_value.nil?
        return nil
      end
    end

each(&block) click to toggle source

    # File lib/chef/node/attribute.rb, line 128
    def each(&block)
      get_keys.each do |key|
        value = determine_value(
          get_value(automatic, key),
          get_value(override, key),
          get_value(normal, key),
          get_value(default, key)
        )
        block.call([key, value])
      end
    end

each_attribute(&block) click to toggle source

    # File lib/chef/node/attribute.rb, line 152
    def each_attribute(&block)
      get_keys.each do |key|
        value = determine_value(
          get_value(automatic, key),
          get_value(override, key),
          get_value(normal, key),
          get_value(default, key)
        )
        block.call(key, value)
      end
    end

each_key(&block) click to toggle source

    # File lib/chef/node/attribute.rb, line 164
    def each_key(&block)
      get_keys.each do |key|
        block.call(key)
      end
    end

each_pair(&block) click to toggle source

    # File lib/chef/node/attribute.rb, line 140
    def each_pair(&block)
      get_keys.each do |key|
        value = determine_value(
          get_value(automatic, key),
          get_value(override, key),
          get_value(normal, key),
          get_value(default, key)
        )
        block.call(key, value)
      end
    end

each_value(&block) click to toggle source

    # File lib/chef/node/attribute.rb, line 170
    def each_value(&block)
      get_keys.each do |key|
        value = determine_value(
          get_value(automatic, key),
          get_value(override, key),
          get_value(normal, key),
          get_value(default, key)
        )
        block.call(value)
      end
    end

empty?() click to toggle source

    # File lib/chef/node/attribute.rb, line 182
    def empty?
      get_keys.empty?
    end

fetch(key, default_value=nil, &block) click to toggle source

    # File lib/chef/node/attribute.rb, line 186
    def fetch(key, default_value=nil, &block)
      if get_keys.include? key
        determine_value(
          get_value(automatic, key),
          get_value(override, key),
          get_value(normal, key),
          get_value(default, key)
        )
      elsif default_value
        default_value
      elsif block_given?
        block.call(key)
      else
        raise IndexError, "Key #{key} does not exist"
      end
    end

get_keys() click to toggle source

    # File lib/chef/node/attribute.rb, line 242
    def get_keys
      keys
    end

get_value(data_hash, key) click to toggle source

    # File lib/chef/node/attribute.rb, line 258
    def get_value(data_hash, key)
      last = nil

      if @current_nesting_level.length == 0
        if data_hash.has_key?(key) && ! data_hash[key].nil?
          return data_hash[key]
        else
          return nil
        end
      end

      0.upto(@current_nesting_level.length) do |i|
        if i == 0
          last = auto_vivifiy(data_hash, @current_nesting_level[i])
        elsif i == @current_nesting_level.length
          fk = last[@current_nesting_level[i - 1]]
          if fk.has_key?(key) && ! fk[key].nil?
            return fk[key]
          else
            return nil
          end
        else
          last = auto_vivifiy(last[@current_nesting_level[i - 1]], @current_nesting_level[i])
        end
      end
    end

has_key?(key) click to toggle source

    # File lib/chef/node/attribute.rb, line 115
    def has_key?(key)
      return true if component_has_key?(@default,key)
      return true if component_has_key?(@automatic,key)
      return true if component_has_key?(@normal,key)
      return true if component_has_key?(@override,key)
      false
    end

Also aliased as: attribute?, include?, key?, member?
has_value?(value) click to toggle source

    # File lib/chef/node/attribute.rb, line 217
    def has_value?(value)
      self.any? do |k,v|
        value == v
      end
    end

Also aliased as: value?
hash_and_not_cna?(to_check) click to toggle source

    # File lib/chef/node/attribute.rb, line 285
    def hash_and_not_cna?(to_check)
      (! to_check.kind_of?(Chef::Node::Attribute)) && to_check.respond_to?(:has_key?)
    end

include?(key) click to toggle source
Alias for: has_key?
index(value) click to toggle source

    # File lib/chef/node/attribute.rb, line 225
    def index(value)
      index = self.find do |h|
        value == h[1]
      end
      index.first if index.is_a? Array || nil
    end

inspect() click to toggle source

    # File lib/chef/node/attribute.rb, line 453
    def inspect
      determine_value(current_automatic, current_override, current_normal, current_default)

      "#<#{self.class} " << instance_variables.map{|iv|
        iv.to_s + '=' + (HIDDEN_ATTRIBUES.include?(iv.to_sym) ? "{...}" : instance_variable_get(iv).inspect)
      }.join(', ') << ">"
    end

key?(key) click to toggle source
Alias for: has_key?
keys() click to toggle source

    # File lib/chef/node/attribute.rb, line 246
    def keys
      tkeys = current_automatic ? current_automatic.keys : []
      [ current_override, current_normal, current_default ].each do |attr_hash|
        if attr_hash
          attr_hash.keys.each do |key|
            tkeys << key unless tkeys.include?(key)
          end
        end
      end
      tkeys
    end

kind_of?(klass) click to toggle source

Writing this method hurts me a little bit.

TODO: Refactor all this stuff so this kind of horror is no longer needed

We have invented a new kind of duck-typing, we call it Madoff typing. We just lie and hope we die before you recognize our scheme. :)

    # File lib/chef/node/attribute.rb, line 209
    def kind_of?(klass)
      if klass == Hash || klass == Mash || klass == Chef::Node::Attribute
        true
      else
        false
      end
    end

length() click to toggle source
Alias for: size
member?(key) click to toggle source
Alias for: has_key?
method_missing(symbol, *args) click to toggle source

Fetches or sets the value, depending on if any arguments are given.

#### Fetching

If no arguments are given, fetches the value:

    node.network
    => {network data}

Getters will find either a string or symbol key.

#### Setting

If arguments are given, a value will be set. Both normal setter and DSL style setters are allowed:

    node.foo = "bar"
    node.foo("bar")

Both set node = "bar"

    # File lib/chef/node/attribute.rb, line 435
    def method_missing(symbol, *args)
      if args.empty?
        if key?(symbol)
          self[symbol]
        elsif key?(symbol.to_s)
          self[symbol.to_s]
        elsif auto_vivifiy_on_read?
          self[symbol] = Mash.new
          self[symbol]
        else
          raise ArgumentError, "Attribute #{symbol} is not defined!" unless auto_vivifiy_on_read
        end
      else
        key_to_set = symbol.to_s[/^(.+)=$/, 1] || symbol
        self[key_to_set] = (args.length == 1 ? args[0] : args)
      end
    end

reset() click to toggle source

Reset our internal current_nesting_level to the top of every tree

    # File lib/chef/node/attribute.rb, line 80
    def reset
      @current_normal = @normal
      @current_default = @default
      @current_override = @override
      @current_automatic = @automatic
      @has_been_read = false
      @current_nesting_level = []
    end

set_type_hash() click to toggle source

    # File lib/chef/node/attribute.rb, line 66
    def set_type_hash
      case @set_type
      when :normal
        @normal
      when :override
        @override
      when :default
        @default
      when :automatic
        @automatic
      end
    end

set_value(data_hash, key, value) click to toggle source

    # File lib/chef/node/attribute.rb, line 359
    def set_value(data_hash, key, value)
      last = nil

      # If there is no current_nesting_level, just set the value
      if @current_nesting_level.length == 0
        data_hash[key] = value
        return data_hash
      end

      # Walk all the previous places we have been
      0.upto(@current_nesting_level.length) do |i|
        # If we are the first, we are top level, and should vivifiy the data_hash
        if i == 0
          last = auto_vivifiy(data_hash, @current_nesting_level[i])
        # If we are one past the last current_nesting_level, we are adding a key to that hash with a value
        elsif i == @current_nesting_level.length
          last[@current_nesting_level[i - 1]][key] = value
        # Otherwise, we're auto-vivifiy-ing an interim mash
        else
          last = auto_vivifiy(last[@current_nesting_level[i - 1]], @current_nesting_level[i])
        end
      end
      data_hash
    end

size() click to toggle source

    # File lib/chef/node/attribute.rb, line 236
    def size
      self.collect{}.length
    end

Also aliased as: length
to_hash() click to toggle source

    # File lib/chef/node/attribute.rb, line 461
    def to_hash
      result = determine_value(current_automatic, current_override, current_normal, current_default)
      if result.class == Hash
        result
      else
        result.to_hash
      end
    end

value?(value) click to toggle source
Alias for: has_value?
value_at_current_nesting(component_attrs, key) click to toggle source

    # File lib/chef/node/attribute.rb, line 494
    def value_at_current_nesting(component_attrs, key)
      @current_nesting_level.inject(component_attrs) do |subtree, intermediate_key|
        # if the intermediate value isn't a hash or doesn't have the intermediate key,
        # it can't have the bottom-level key we're looking for.
        (subtree.respond_to?(:key?) && subtree[intermediate_key]) or (return false)
      end
    end

value_or_descend(data_hash, key, auto_vivifiy=false) click to toggle source

    # File lib/chef/node/attribute.rb, line 399
    def value_or_descend(data_hash, key, auto_vivifiy=false)
      if auto_vivifiy
        hash_to_vivifiy = auto_vivifiy(data_hash, key)
        data_hash[key] = hash_to_vivifiy[key]
      else
        return nil if data_hash == nil
        return nil unless data_hash.has_key?(key)
      end

      if data_hash[key].respond_to?(:has_key?)
        cna = Chef::Node::Attribute.new(@normal, @default, @override, @automatic, @current_nesting_level)
        cna.current_normal = current_normal.nil? ? Mash.new : current_normal[key]
        cna.current_default   = current_default.nil? ? Mash.new : current_default[key]
        cna.current_override  = current_override.nil? ? Mash.new : current_override[key]
        cna.current_automatic  = current_automatic.nil? ? Mash.new : current_automatic[key]
        cna.auto_vivifiy_on_read = auto_vivifiy_on_read
        cna.set_unless_value_present = set_unless_value_present
        cna.set_type = set_type
        cna
      else
        data_hash[key]
      end
    end

values() click to toggle source

    # File lib/chef/node/attribute.rb, line 232
    def values
      self.collect { |h| h[1] }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.