summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-06 15:24:02 -0800
committerdanielsdeleo <dan@chef.io>2016-02-16 15:26:43 -0800
commitf85d570f766c783e7c4f8d00922df211d5b9b577 (patch)
treeb876a21d880796dbfd784660996040be756604cd
parentcdd4bc5067640873a7670a8fe036e4b807f5bc9d (diff)
downloadchef-f85d570f766c783e7c4f8d00922df211d5b9b577.tar.gz
Reorganize inlined code idiomatically
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 9f4bf08736..5161ca087f 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -30,6 +30,13 @@ class Chef
# methods/if branches for each.
class ChefRepositoryFileSystemCookbookEntry
+ attr_reader :name
+ attr_reader :parent
+ attr_reader :path
+ attr_reader :ruby_only
+ attr_reader :recursive
+ attr_reader :file_path
+
def initialize(name, parent, file_path = nil, ruby_only = false, recursive = false)
@parent = parent
@name = name
@@ -40,9 +47,6 @@ class Chef
@file_path = file_path || "#{parent.file_path}/#{name}"
end
- attr_reader :ruby_only
- attr_reader :recursive
-
def children
begin
entries = Dir.entries(file_path).sort.
@@ -86,16 +90,6 @@ class Chef
false
end
- protected
-
- def make_child_entry(child_name)
- ChefRepositoryFileSystemCookbookEntry.new(child_name, self, nil, ruby_only, recursive)
- end
-
- public
-
- attr_reader :file_path
-
def path_for_printing
file_path
end
@@ -154,10 +148,6 @@ class Chef
end
end
- attr_reader :name
- attr_reader :parent
- attr_reader :path
-
def child(name)
if can_have_child?(name, true) || can_have_child?(name, false)
result = make_child_entry(name)
@@ -182,6 +172,12 @@ class Chef
parent.root
end
+ protected
+
+ def make_child_entry(child_name)
+ ChefRepositoryFileSystemCookbookEntry.new(child_name, self, nil, ruby_only, recursive)
+ end
+
end
end
end