    # File lib/chef/cookbook/cookbook_version_loader.rb, line 91
          def metadata(cookbook_version)
            @metadata = Chef::Cookbook::Metadata.new(cookbook_version)
            @metadata_filenames.each do |metadata_file|
              case metadata_file
              when /\.rb$/
                apply_ruby_metadata(metadata_file)
              when /\.json$/
                apply_json_metadata(metadata_file)
              else
                raise RuntimeError, "Invalid metadata file: #{metadata_file} for cookbook: #{cookbook_version}"
              end
            end
            @metadata
          end