Sha256: be028ecd7032cfeacd725b5d2acaed99f78530b5e806f244e04b98c9baea89a3

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

require 'chef_fs/file_system/rest_list_dir'
require 'chef_fs/file_system/data_bag_dir'

module ChefFS
  module FileSystem
    class DataBagsDir < RestListDir
      def initialize(parent)
        super("data_bags", parent, "data")
      end

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

      def children
        @children ||= rest.get_rest(api_path).keys.map { |entry| DataBagDir.new(entry, self, true) }
      end

      def can_have_child?(name, is_dir)
        is_dir
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-essentials-0.4 lib/chef_fs/file_system/data_bags_dir.rb
knife-essentials-0.3.1 lib/chef_fs/file_system/data_bags_dir.rb