Class: ChefFS::FileSystem::CookbookSubdir
- Inherits:
-
BaseFSDir
- Object
- BaseFSObject
- BaseFSDir
- ChefFS::FileSystem::CookbookSubdir
- Defined in:
- lib/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
#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.
24 25 26 27 28 29 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 24 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.
32 33 34 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 32 def children @children end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
31 32 33 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 31 def versions @versions end |
Instance Method Details
#add_child(child) ⇒ Object
34 35 36 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 34 def add_child(child) @children << child end |
#can_have_child?(name, is_dir) ⇒ Boolean
38 39 40 41 42 43 44 45 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 38 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
47 48 49 |
# File 'lib/chef_fs/file_system/cookbook_subdir.rb', line 47 def rest parent.rest end |