Sha256: 66e349160c13d6d2cb0651d1f123b9b8680d17a037f74cb1d3e0492fd377b0f2

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

require 'chef_fs/file_system/rest_list_dir'
require 'chef_fs/file_system/cookbook_dir'

module ChefFS
  module FileSystem
    class CookbooksDir < RestListDir
      def initialize(parent)
        super("cookbooks", parent)
      end

      def child(name)
        result = @children.select { |child| child.name == name }.first if @children
        result || CookbookDir.new(name, self)
      end

      def children
        @children ||= rest.get_rest(api_path).map { |key, value| CookbookDir.new(key, self, value) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-essentials-0.1.1 lib/chef_fs/file_system/cookbooks_dir.rb
knife-essentials-0.1 lib/chef_fs/file_system/cookbooks_dir.rb