Class: Chef::ChefFS::FileSystem::ChefServer::CookbookSubdir
- Inherits:
-
BaseFSDir
- Object
- BaseFSObject
- BaseFSDir
- Chef::ChefFS::FileSystem::ChefServer::CookbookSubdir
- Defined in:
- lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Attributes inherited from BaseFSObject
Instance Method Summary collapse
- #add_child(child) ⇒ Object
- #can_have_child?(name, is_dir) ⇒ Boolean
-
#initialize(name, parent, ruby_only, recursive) ⇒ CookbookSubdir
constructor
A new instance of CookbookSubdir.
- #make_child_entry(name) ⇒ Object
- #rest ⇒ Object
Methods inherited from BaseFSDir
Methods inherited from BaseFSObject
#chef_object, #child, #compare_to, #create_child, #delete, #dir?, #exists?, #path_for_printing, #read, #root, #write
Constructor Details
#initialize(name, parent, ruby_only, recursive) ⇒ CookbookSubdir
Returns a new instance of CookbookSubdir.
26 27 28 29 30 31 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 26 def initialize(name, parent, ruby_only, recursive) super(name, parent) @children = [] @ruby_only = ruby_only @recursive = recursive end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
34 35 36 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 34 def children @children end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
33 34 35 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 33 def versions @versions end |
Instance Method Details
#add_child(child) ⇒ Object
36 37 38 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 36 def add_child(child) @children << child end |
#can_have_child?(name, is_dir) ⇒ Boolean
40 41 42 43 44 45 46 47 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 40 def can_have_child?(name, is_dir) if is_dir return false unless @recursive else return false if @ruby_only && name !~ /\.rb$/ end true end |
#make_child_entry(name) ⇒ Object
49 50 51 52 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 49 def make_child_entry(name) result = @children.find { |child| child.name == name } if @children result || NonexistentFSObject.new(name, self) end |
#rest ⇒ Object
54 55 56 |
# File 'lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb', line 54 def rest parent.rest end |