Class: Chef::ChefFS::FileSystem::CookbookSubdir
- Inherits:
-
BaseFSDir
- Object
- BaseFSObject
- BaseFSDir
- Chef::ChefFS::FileSystem::CookbookSubdir
- Defined in:
- lib/chef/chef_fs/file_system/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.
- #rest ⇒ Object
Methods inherited from BaseFSDir
Methods inherited from BaseFSObject
#child, #compare_to, #dir?, #exists?, #path_for_printing, #root
Constructor Details
#initialize(name, parent, ruby_only, recursive) ⇒ CookbookSubdir
Returns a new instance of CookbookSubdir.
25 26 27 28 29 30 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 25 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.
33 34 35 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 33 def children @children end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
32 33 34 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 32 def versions @versions end |
Instance Method Details
#add_child(child) ⇒ Object
35 36 37 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 35 def add_child(child) @children << child end |
#can_have_child?(name, is_dir) ⇒ Boolean
39 40 41 42 43 44 45 46 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 39 def can_have_child?(name, is_dir) if is_dir return false if !@recursive else return false if @ruby_only && name !~ /\.rb$/ end true end |
#rest ⇒ Object
48 49 50 |
# File 'lib/chef/chef_fs/file_system/cookbook_subdir.rb', line 48 def rest parent.rest end |