Created
August 4, 2009 17:27
-
-
Save stevenharman/161364 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
// started here | |
public class Entry : Entity | |
{ | |
private DateTime _createdAt; | |
public bool IsWithinEditWindow() | |
{ | |
return _createdAt.IsAfter(20.Minutes().Ago()); | |
} | |
} | |
// moving toward configurable | |
public class Entry : Entity | |
{ | |
private DateTime _createdAt; | |
private static TimeSpan _editTimeWindow = 20.Minutes(); | |
public bool IsWithinEditWindow() | |
{ | |
return _createdAt.IsAfter(_editTimeWindow.Ago()); | |
} | |
} | |
// configurable via outside definition | |
public class Entry : Entity | |
{ | |
private DateTime _createdAt; | |
// is a static gateway the best we can do here? | |
private static TimeSpan _editTimeWindow = SomeConfigThing.EntryEditTimeWindow ?? 20.Minutes(); | |
public bool IsWithinEditWindow() | |
{ | |
return _createdAt.IsAfter(_editTimeWindow.Ago()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment