Skip to content

Commit

Permalink
Fix immutable pattern in EmitterSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
FSDKO committed Jan 15, 2021
1 parent c5d9488 commit 8c29294
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions YamlDotNet/Core/EmitterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public EmitterSettings WithBestIndent(int bestIndent)
bestIndent,
BestWidth,
IsCanonical,
MaxSimpleKeyLength
MaxSimpleKeyLength,
SkipAnchorName
);
}

Expand All @@ -99,7 +100,8 @@ public EmitterSettings WithBestWidth(int bestWidth)
BestIndent,
bestWidth,
IsCanonical,
MaxSimpleKeyLength
MaxSimpleKeyLength,
SkipAnchorName
);
}

Expand All @@ -109,7 +111,8 @@ public EmitterSettings WithMaxSimpleKeyLength(int maxSimpleKeyLength)
BestIndent,
BestWidth,
IsCanonical,
maxSimpleKeyLength
maxSimpleKeyLength,
SkipAnchorName
);
}

Expand All @@ -119,14 +122,20 @@ public EmitterSettings Canonical()
BestIndent,
BestWidth,
true,
MaxSimpleKeyLength
MaxSimpleKeyLength,
SkipAnchorName
);
}

public EmitterSettings WithoutAnchorName()
{
SkipAnchorName = true;
return this;
return new EmitterSettings(
BestIndent,
BestWidth,
IsCanonical,
MaxSimpleKeyLength,
true
);
}
}
}

0 comments on commit 8c29294

Please sign in to comment.