Respond to PR feedback.

Small variable rename.
This commit is contained in:
Eric Erhardt 2016-10-10 16:07:31 -05:00
parent 633b56e448
commit 85a737c223
2 changed files with 9 additions and 6 deletions

View file

@ -11,7 +11,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
private readonly string _metadataValue;
private readonly Func<T, string> _metadataValueFunc;
private readonly Func<T, bool> _writeMetadataFunc;
private readonly Func<T, bool> _writeMetadataConditionFunc;
public ItemMetadataValue(string metadataName, string metadataValue)
{
@ -19,16 +19,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
_metadataValue = metadataValue;
}
public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataFunc = null)
public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataConditionFunc = null)
{
MetadataName = metadataName;
_metadataValueFunc = metadataValueFunc;
_writeMetadataFunc = writeMetadataFunc;
_writeMetadataConditionFunc = writeMetadataConditionFunc;
}
public bool ShouldWriteMetadata(T source)
{
return _writeMetadataFunc == null || _writeMetadataFunc(source);
return _writeMetadataConditionFunc == null || _writeMetadataConditionFunc(source);
}
public string GetMetadataValue(T source)

View file

@ -82,9 +82,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return this;
}
public AddItemTransform<T> WithMetadata(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataFunc = null)
public AddItemTransform<T> WithMetadata(
string metadataName,
Func<T, string> metadataValueFunc,
Func<T, bool> writeMetadataConditionFunc = null)
{
_metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc, writeMetadataFunc));
_metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc, writeMetadataConditionFunc));
return this;
}