Created
June 1, 2018 16:39
-
-
Save Diggsey/46e5641f810f57adc5de6b99858f52a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Patch struct { | |
// Implementation detail, should not be accessed | |
from string | |
to string | |
} | |
func NewPatch(from string, to string) *Patch { | |
return &Patch { from, to } | |
} | |
func (patch *Patch) Apply(from string) string { | |
if patch.from != from { | |
panic("Patch applied incorrectly") | |
} | |
return patch.to | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment