def metadata_with_correct_capability(metadata)
      capability = self.class::CAPABILITY
      raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
      return Metadata.new(capability: capability) unless metadata
      raise ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
      raise ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
      metadata
    end
def metadata_with_correct_capability(metadata)
      capability = self.class::CAPABILITY
      raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
      return Metadata.new(capability: capability) unless metadata
      raise ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
      raise ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
      metadata
    end
------------------------------
 Parameter validators
 Validates the +capability+ attribute in the specified metadata.
 @raise [ArgumentError] if the specified metadata does not have the correct +capability+ attribute for this list type.