Class: Chef::ChefFS::DataHandler::EnvironmentDataHandler
Instance Method Summary
collapse
#chef_object, #default, #from_ruby, #minimize, #normalize_for_post, #normalize_for_put, #normalize_hash, #normalize_run_list, #remove_file_extension, #to_ruby_keys, #verify_integrity
Instance Method Details
#chef_class ⇒ Object
24
25
26
|
# File 'lib/chef/chef_fs/data_handler/environment_data_handler.rb', line 24
def chef_class
Chef::Environment
end
|
#normalize(environment, entry) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/chef/chef_fs/data_handler/environment_data_handler.rb', line 8
def normalize(environment, entry)
normalize_hash(environment, {
"name" => remove_file_extension(entry.name),
"description" => "",
"cookbook_versions" => {},
"default_attributes" => {},
"override_attributes" => {},
"json_class" => "Chef::Environment",
"chef_type" => "environment",
})
end
|
#preserve_key?(key) ⇒ Boolean
20
21
22
|
# File 'lib/chef/chef_fs/data_handler/environment_data_handler.rb', line 20
def preserve_key?(key)
key == "name"
end
|
#to_ruby(object) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/chef/chef_fs/data_handler/environment_data_handler.rb', line 28
def to_ruby(object)
result = to_ruby_keys(object, %w{name description default_attributes override_attributes})
if object["cookbook_versions"]
object["cookbook_versions"].each_pair do |name, version|
result << "cookbook #{name.inspect}, #{version.inspect}"
end
end
result
end
|