Class: Chef::ChefFS::FileSystem::ChefServer::EnvironmentsDir::DefaultEnvironmentEntry

Inherits:
RestListEntry show all
Defined in:
lib/chef/chef_fs/file_system/chef_server/environments_dir.rb

Instance Attribute Summary

Attributes inherited from BaseFSObject

#name, #parent, #path

Instance Method Summary collapse

Methods inherited from RestListEntry

#_read_json, #api_child_name, #api_error_text, #api_path, #chef_object, #compare_to, #data_handler, #display_name, #display_path, #environment, #exists?, #minimize_value, #org, #read, #rest

Methods inherited from BaseFSObject

#can_have_child?, #chef_object, #child, #children, #compare_to, #create_child, #dir?, #exists?, #path_for_printing, #read, #root

Constructor Details

#initialize(name, parent, exists = nil) ⇒ DefaultEnvironmentEntry

Returns a new instance of DefaultEnvironmentEntry.



37
38
39
40
# File 'lib/chef/chef_fs/file_system/chef_server/environments_dir.rb', line 37

def initialize(name, parent, exists = nil)
  super(name, parent)
  @exists = exists
end

Instance Method Details

#delete(recurse) ⇒ Object

Raises:



42
43
44
45
46
# File 'lib/chef/chef_fs/file_system/chef_server/environments_dir.rb', line 42

def delete(recurse)
  raise NotFoundError.new(self) unless exists?

  raise DefaultEnvironmentCannotBeModifiedError.new(:delete, self)
end

#write(file_contents) ⇒ Object

Raises:



48
49
50
51
52
# File 'lib/chef/chef_fs/file_system/chef_server/environments_dir.rb', line 48

def write(file_contents)
  raise NotFoundError.new(self) unless exists?

  raise DefaultEnvironmentCannotBeModifiedError.new(:write, self)
end