Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created August 4, 2009 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenharman/161364 to your computer and use it in GitHub Desktop.
Save stevenharman/161364 to your computer and use it in GitHub Desktop.
// 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