Module: KnifeAttribute::Environment::Helpers

Includes:
Helpers
Included in:
EnvironmentAttributeDelete, EnvironmentAttributeGet, EnvironmentAttributeSet
Defined in:
lib/knife-attribute/environment/helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#attribute, #attribute_type_map, #default_attribute_type, #entity, #entity_name, #mapped_config, #value

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/knife-attribute/environment/helpers.rb', line 6

def self.included(base)
  base.class_eval do
    deps do
      require 'chef/json_compat'
    end

    def self.attribute_type_map
      {
        default: :default_attributes,
        override: :override_attributes,
      }
    end

    def self.default_attribute_type
      :default
    end
  end
end

Instance Method Details

#entity_typeObject



29
30
31
# File 'lib/knife-attribute/environment/helpers.rb', line 29

def entity_type
  :environment
end

#environmentObject



25
26
27
# File 'lib/knife-attribute/environment/helpers.rb', line 25

def environment
  @environment ||= Chef::Environment.load(entity_name)
end