Class: ChefFS::FileSystem::EnvironmentsDir::DefaultEnvironmentEntry

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

Instance Attribute Summary

Attributes inherited from BaseFSObject

#name, #parent, #path

Instance Method Summary collapse

Methods inherited from RestListEntry

#_read_hash, #api_child_name, #api_path, #chef_object, #compare_to, #data_handler, #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.



41
42
43
44
# File 'lib/chef_fs/file_system/environments_dir.rb', line 41

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

Instance Method Details

#delete(recurse) ⇒ Object

Raises:



46
47
48
49
# File 'lib/chef_fs/file_system/environments_dir.rb', line 46

def delete(recurse)
  raise NotFoundError.new(self) if !exists?
  raise DefaultEnvironmentCannotBeModifiedError.new(:delete, self), "#{path_for_printing} cannot be deleted."
end

#write(file_contents) ⇒ Object

Raises:



51
52
53
54
# File 'lib/chef_fs/file_system/environments_dir.rb', line 51

def write(file_contents)
  raise NotFoundError.new(self) if !exists?
  raise DefaultEnvironmentCannotBeModifiedError.new(:write, self), "#{path_for_printing} cannot be updated."
end