Class: ChefFS::FileSystem::AclDir
Instance Attribute Summary
Attributes inherited from BaseFSObject
#name, #parent, #path
Instance Method Summary
collapse
Methods inherited from BaseFSDir
#dir?, #initialize
#chef_object, #compare_to, #delete, #dir?, #exists?, #initialize, #path_for_printing, #read, #root, #write
Instance Method Details
#api_path ⇒ Object
26
27
28
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 26
def api_path
parent.parent.child(name).api_path
end
|
#can_have_child?(name, is_dir) ⇒ Boolean
36
37
38
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 36
def can_have_child?(name, is_dir)
name =~ /\.json$/ && !is_dir
end
|
#child(name) ⇒ Object
30
31
32
33
34
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 30
def child(name)
result = @children.select { |child| child.name == name }.first if @children
result ||= can_have_child?(name, false) ?
AclEntry.new(name, self) : NonexistentFSObject.new(name, self)
end
|
#children ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 40
def children
if @children.nil?
names = parent.parent.child(name).children.map { |child| child.dir? ? "#{child.name}.json" : child.name }
@children = names.map { |name| AclEntry.new(name, self, true) }
end
@children
end
|
#create_child(name, file_contents) ⇒ Object
49
50
51
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 49
def create_child(name, file_contents)
raise OperationNotAllowedError.new(:create_child, self), "ACLs can only be updated, and can only be created when the corresponding object is created."
end
|
#data_handler ⇒ Object
53
54
55
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 53
def data_handler
parent.data_handler
end
|
#rest ⇒ Object
57
58
59
|
# File 'lib/chef_fs/file_system/acl_dir.rb', line 57
def rest
parent.rest
end
|